Skip to contentSkip to conversation

usx2y: prevent oops & dead keyboard on hot usb unplugging

PATCH karsten wiese 2 participants 2 messages Apr 19, 2005 – Apr 20, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 31 lines · --- Takashi Iwai

At Sat, 16 Apr 2005 02:31:06 +0200 (CEST),

Quoted 10 lines · karsten wiese
Quoted 8 lines · --- Clemens Ladisch
Quoted 4 lines · Takashi Iwai
Quoted 1 line · karsten wiese

(-: You apply my patch now?

No, not enough :) This is exactly why

snd_card_free_in_thread() was

Quoted 2 lines

introduced.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

As I asked, please make sure that the files are all

released before

Quoted 1 line

snd_card_free(). Otherwise the disconnect callback

hangs at this

Quoted 1 line

point because of this check.

Most programs close the device file when an error

occurs,

Quoted 11 lines
Quoted 11 lines

so you have
to test it with something like this to keep the file open:

#include <stdio.h>
int main()
{
fopen("/dev/snd/hwC1D0", "rb");
getchar();
}

Quoted 5 lines
Quoted 2 lines

Tested with it, see attached shell log (copied+pasted). Any more tests needed?

Did you check whether the release fops callback
(e.g. snd_hwdep_release) is called?

Yes: All snd_*_release() functions call snd_card_file_remove() and snd_card_file_remove() definitly was called as usX2Y_usb_disconnect() finished correctly, when the client closed it's fd(s).
Only snd_card_file_remove() calls wake_up(&card->shutdown_sleep).
Only other places where snd_card_file_remove() is called are the snd_*_open() functions error paths, but those where not involved, as lsof stabily showed that /dev/snd/hwC1D0 was held open by a.out (the client).

Karsten

___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728

#1 lore raw

At Tue, 19 Apr 2005 23:22:06 +0200 (CEST),

Quoted 40 lines · karsten wiese
Quoted 31 lines · --- Takashi Iwai

At Sat, 16 Apr 2005 02:31:06 +0200 (CEST),

Quoted 10 lines · karsten wiese
Quoted 8 lines · --- Clemens Ladisch
Quoted 4 lines · Takashi Iwai
Quoted 1 line · karsten wiese

(-: You apply my patch now?

No, not enough :) This is exactly why

snd_card_free_in_thread() was

Quoted 2 lines

introduced.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

As I asked, please make sure that the files are all

released before

Quoted 1 line

snd_card_free(). Otherwise the disconnect callback

hangs at this

Quoted 1 line

point because of this check.

Most programs close the device file when an error

occurs,

Quoted 11 lines
Quoted 11 lines

so you have
to test it with something like this to keep the file open:

#include <stdio.h>
int main()
{
fopen("/dev/snd/hwC1D0", "rb");
getchar();
}

Quoted 5 lines
Quoted 2 lines

Tested with it, see attached shell log (copied+pasted). Any more tests needed?

Did you check whether the release fops callback
(e.g. snd_hwdep_release) is called?

Quoted 10 lines

Yes: All snd_*_release() functions call snd_card_file_remove() and snd_card_file_remove() definitly was called as usX2Y_usb_disconnect() finished correctly, when the client closed it's fd(s).
Only snd_card_file_remove() calls wake_up(&card->shutdown_sleep).
Only other places where snd_card_file_remove() is called are the snd_*_open() functions error paths, but those where not involved, as lsof stabily showed that /dev/snd/hwC1D0 was held open by a.out (the client).

OK, thanks for the confirmation!

Now I applied your patch (also modified usbaudio.c) together with the kernel version check in *.patch files.

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728