mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	PCM: plug: Move fast_ops copy after slave configuration.
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) The plug plugin copies the fast_ops structure and fast_op_arg from its slave PCM on initialization and after inserting a new plugin. This works unless the slave PCM is also an instance of the plug plugin because plug can change its fast_ops structure during _snd_pcm_hw_params. Instead of copying fast_ops in snd_pcm_plug_insert_plugins wait until the end of snd_pcm_plug_hw_params when the slave has been fully initialized. This fixes a crash when two instances of plug are instantiated back to back and the format conversion plugin inserted by the second is skipped by the first because the fast_ops pointer is not properly updated. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									59de61e5b5
								
							
						
					
					
						commit
						f285572102
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -659,8 +659,6 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
 | 
			
		|||
		}
 | 
			
		||||
		if (err) {
 | 
			
		||||
			plug->gen.slave = new;
 | 
			
		||||
			pcm->fast_ops = new->fast_ops;
 | 
			
		||||
			pcm->fast_op_arg = new->fast_op_arg;
 | 
			
		||||
		}
 | 
			
		||||
		k++;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1049,6 +1047,9 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 | 
			
		|||
	}
 | 
			
		||||
	snd_pcm_unlink_hw_ptr(pcm, plug->req_slave);
 | 
			
		||||
	snd_pcm_unlink_appl_ptr(pcm, plug->req_slave);
 | 
			
		||||
 | 
			
		||||
	pcm->fast_ops = slave->fast_ops;
 | 
			
		||||
	pcm->fast_op_arg = slave->fast_op_arg;
 | 
			
		||||
	snd_pcm_link_hw_ptr(pcm, slave);
 | 
			
		||||
	snd_pcm_link_appl_ptr(pcm, slave);
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue