[alsa-devel] usb audio race at disconnect time
matthieu.castet at parrot.com
Thu Oct 18 17:39:05 CEST 2012
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 .
>>>> 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 .
> Check out my latest patches in topic/usb-disconnect-fix branch.
> It's been fixed there.
the first tests seems ok.
We will do more strees test.
More information about the Alsa-devel