Skip to contentSkip to conversation

Reset file->f_op in snd_card_file_remove()

PATCH In review Karsten Wiese 2 participants 5 messages Sep 27, 2006 – Sep 28, 2006 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reset file->f_op in snd_card_file_remove()

Hi

This patch helps prevent an oops on 2.6.18-rt3, when my usb usx2y soundcard disconnects. Physically disconnects or "rmmod uhci_hc" both oops 1in7.

With this patch still no oops after > 1000 disconnects.

Please apply/comment.

thanks,
Karsten

===

Reset file->f_op in snd_card_file_remove()

When passing here in response to an usb disconnect, file->f_op has been replaced with a kmalloc()ed version, that would only allow releases.

It will be free()ed later on in snd_card_free().
Here it happened sometimes, that the free()ed, not NULLed file->f_op caused an oops in module_put() called by fops_put() still later on.

sound/core/init.c +1 -0
@@ -722,6 +722,7 @@ int snd_card_file_remove(struct snd_card
 	mfile = card->files;
 	while (mfile) {
 		if (mfile->file == file) {
+			file->f_op = NULL;
 			if (pfile)
 				pfile->next = mfile->next;
 			else

___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#1 lore raw

At Wed, 27 Sep 2006 21:27:51 +0200,

Quoted 22 lines · Karsten Wiese

Hi

This patch helps prevent an oops on 2.6.18-rt3, when my usb usx2y soundcard disconnects. Physically disconnects or "rmmod uhci_hc" both oops 1in7.

With this patch still no oops after > 1000 disconnects.

Please apply/comment.

thanks,
Karsten

===

Reset file->f_op in snd_card_file_remove()

When passing here in response to an usb disconnect, file->f_op has been replaced with a kmalloc()ed version, that would only allow releases.

Quoted 5 lines

It will be free()ed later on in snd_card_free().
Here it happened sometimes, that the free()ed, not NULLed file->f_op caused an oops in module_put() called by fops_put() still later on.

snd_card_file_remove() is not a right place to do that, IMO.

Could you check whether this problem still happens on post-2.6.18? There are a lot of fixes in this area after 2.6.18.

Takashi

Quoted 18 lines
sound/core/init.c +1 -0
@@ -722,6 +722,7 @@ int snd_card_file_remove(struct snd_card
 	mfile = card->files;
 	while (mfile) {
 		if (mfile->file == file) {
+			file->f_op = NULL;
 			if (pfile)
 				pfile->next = mfile->next;
 			else
Quoted 3 lines

___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#2 lore raw
Quoted 24 lines · --- Takashi Iwai

At Wed, 27 Sep 2006 21:27:51 +0200,

Quoted 22 lines · Karsten Wiese

Hi

This patch helps prevent an oops on 2.6.18-rt3, when my usb usx2y soundcard disconnects. Physically disconnects or "rmmod uhci_hc" both oops 1in7.

With this patch still no oops after > 1000 disconnects.

Please apply/comment.

thanks,
Karsten

===

Reset file->f_op in snd_card_file_remove()

When passing here in response to an usb disconnect, file->f_op has been replaced with a kmalloc()ed version, that would only allow releases.

Quoted 8 lines
Quoted 5 lines

It will be free()ed later on in snd_card_free().
Here it happened sometimes, that the free()ed, not NULLed file->f_op caused an oops in module_put() called by fops_put() still later on.

snd_card_file_remove() is not a right place to do that, IMO.

you are right, patch is wrong: it causes snd_hwdep's use count corruption.

Quoted 3 lines

Could you check whether this problem still happens on post-2.6.18? There are a lot of fixes in this area after 2.6.18.

i'm now running 2.6.18-rt3 + alsa-driver-1.0.13rc1 and problem seams to be gone.

Karsten

___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#3 lore raw
Quoted 2 lines · --- karsten wiese

i'm now running 2.6.18-rt3 + alsa-driver-1.0.13rc1 and problem seams to be gone.

its alsa-driver-1.0.13rc3.

Karsten

___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

#4 lore raw
In reply to karsten wiese

At Thu, 28 Sep 2006 13:39:06 +0200 (CEST),

Quoted 33 lines · karsten wiese
Quoted 30 lines · --- Takashi Iwai

At Wed, 27 Sep 2006 21:27:51 +0200,

Quoted 27 lines · Karsten Wiese

Hi

This patch helps prevent an oops on 2.6.18-rt3, when my usb usx2y soundcard disconnects. Physically disconnects or "rmmod uhci_hc" both oops 1in7.

With this patch still no oops after > 1000 disconnects.

Please apply/comment.

thanks,
Karsten

===

Reset file->f_op in snd_card_file_remove()

When passing here in response to an usb disconnect, file->f_op has been replaced with a kmalloc()ed version, that would only allow releases.

It will be free()ed later on in snd_card_free().
Here it happened sometimes, that the free()ed, not NULLed file->f_op caused an oops in module_put() called by fops_put() still later on.

Quoted 8 lines
Quoted 2 lines

snd_card_file_remove() is not a right place to do that, IMO.

you are right, patch is wrong: it causes snd_hwdep's use count corruption.

Quoted 3 lines

Could you check whether this problem still happens on post-2.6.18? There are a lot of fixes in this area after 2.6.18.

i'm now running 2.6.18-rt3 + alsa-driver-1.0.13rc1 and problem seams to be gone.

Good to hear. Thanks for confirmation!

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV