ALSA: Add a reference counter to card instance
For more strict protection for wild disconnections, a refcount is introduced to the card instance, and let it up/down when an object is referred via snd_lookup_*() in the open ops. The free-after-last-close check is also changed to check this refcount instead of the empty list, too. Reported-by: Matthieu CASTET <matthieu.castet@parrot.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -2457,6 +2457,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
|
||||
__error2:
|
||||
snd_card_file_remove(pcm->card, file);
|
||||
__error1:
|
||||
if (pcm)
|
||||
snd_card_unref(pcm->card);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user