[alsa-devel] usb audio race at disconnect time

Takashi Iwai tiwai at suse.de
Mon Oct 29 15:17:11 CET 2012


At Thu, 18 Oct 2012 17:39:05 +0200,
Matthieu CASTET wrote:
> 
> Takashi Iwai a écrit :
> > At Tue, 16 Oct 2012 18:01:13 +0200,
> > Matthieu CASTET wrote:
> >> Takashi Iwai a écrit :
> >>> At Mon, 15 Oct 2012 19:41:40 +0200,
> >>> Matthieu CASTET wrote:
> >>>> Hi Takashi,
> >>>>
> >>>> But I believe I found other races in the alsa char device handling. With the
> >>>> attached patch, if you disconnect the usb audio device between "msleep o" and
> >>>> "msleep o+", you will free the card resource (snd_card_do_free) and then use it [1].
> >>>>
> >>>> I did in in snd_ctl_open, but the same thing could be done in snd_pcm_open, ...
> >>> OK, we'd need a generic open/close protection.
> >>> For PCM, there is already a fix in my last patchset, so it should
> >>> work, but for other devices, the paths are still uncovered.
> >>>
> >> I don't think it will work for pcm : the begin of snd_pcm_open is not protected
> >> by any lock even with your patch
> >> In snd_open we release sound_mutex before calling file->f_op->open.
> >>
> >> The snd_lookup_minor_data and snd_card_file_add should be protected by a lock.
> >> Attached a patch (pcm.crash) that help to trigger [1].
> > 
> > Check out my latest patches in topic/usb-disconnect-fix branch.
> > It's been fixed there.
> > 
> Thanks,
> 
> the first tests seems ok.
> We will do more strees test.

Do you have any good/bad test result?
If no regression is seen, I'm going to apply the patches for 3.7-rc4.


thanks,

Takashi


More information about the Alsa-devel mailing list