All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Reset file->f_op in snd_card_file_remove(). Take 2
@ 2006-09-28 20:28 ` Karsten Wiese
  0 siblings, 0 replies; 31+ messages in thread
From: Karsten Wiese @ 2006-09-28 20:28 UTC (permalink / raw)
  To: linux-kernel, Takashi Iwai; +Cc: mingo, alsa-devel

Hi

It oopses with 2.6.18-rt4 + alsa-kernel-1.0.13rc3 now.
I wrote before, 2.6.18-rt3 + alsa-driver-1.0.13rc3 would be ok,
but its not. bug showed again reliably under memory-pressure.

      Karsten

===

Reset file->f_op in snd_card_file_remove(). Take 2


i think what happens here is:

  us428control runs, kernel has allocated a struct file for /dev/hwC1D0.

  usb disconnect

  snd_usb_usx2y calls snd_card_disconnect,
  tells us428control to exit.

  snd_card_disconnect replaces /dev/hwC1D0's file->f_op
  with a kmalloc()ed version, that would only allow releases.

  us428control starts exiting

  __fput is called with struct file for /dev/hwC1D0.

  snd_card_file_remove() is called, alsa notices struct file
  for /dev/hwC1D0 is about to be closed.
  with patch below, file->f_op would be set NULL now.

  snd_usb_usx2y's free()s snd_card instance and /dev/hwC1D0's
  file->f_ops, those that would only allow releases.

  for reason I would like to know,
  __fput is called again with struct file for /dev/hwC1D0
  from us428control's do_exit().
  __fput see's file->f_op is still set.
  Without patch and under memory pressure, file->f_op can
  point to anything now.


Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>


diff -pur ../alsa/1.0.13/alsa-driver-1.0.13rc3/alsa-kernel/core/init.c rt4-kw/sound/core/init.c
--- ../alsa/1.0.13/alsa-driver-1.0.13rc3/alsa-kernel/core/init.c	2006-09-25 15:33:19.000000000 +0200
+++ rt4-kw/sound/core/init.c	2006-09-28 18:48:15.000000000 +0200
@@ -707,6 +707,8 @@ int snd_card_file_remove(struct snd_card
 	mfile = card->files;
 	while (mfile) {
 		if (mfile->file == file) {
+			fops_put(file->f_op);
+			file->f_op = NULL;
 			if (pfile)
 				pfile->next = mfile->next;
 			else

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2006-10-05 14:12 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-28 20:28 [PATCH] Reset file->f_op in snd_card_file_remove(). Take 2 Karsten Wiese
2006-09-28 20:28 ` Karsten Wiese
2006-09-29 10:48 ` Takashi Iwai
2006-09-29 10:48   ` Takashi Iwai
2006-09-29 12:29   ` Karsten Wiese
2006-09-29 12:29     ` Karsten Wiese
2006-09-29 12:26     ` Ingo Molnar
2006-09-29 12:45     ` Takashi Iwai
2006-09-29 12:45       ` Takashi Iwai
2006-10-01 18:29       ` Karsten Wiese
2006-10-01 18:29         ` Karsten Wiese
2006-10-04  9:22         ` Takashi Iwai
2006-10-04  9:22           ` Takashi Iwai
2006-10-04 10:47           ` Karsten Wiese
2006-10-04 14:18             ` Takashi Iwai
2006-10-04 15:36               ` Karsten Wiese
2006-10-04 15:36                 ` Karsten Wiese
2006-10-04 15:57                 ` Takashi Iwai
2006-10-04 15:57                   ` Takashi Iwai
2006-10-04 20:01                   ` Karsten Wiese
2006-10-04 20:01                     ` Karsten Wiese
2006-10-04 20:15                     ` Takashi Iwai
2006-10-04 20:15                       ` Takashi Iwai
2006-10-04 23:41                       ` Karsten Wiese
2006-10-04 23:41                         ` Karsten Wiese
2006-10-05 10:43                         ` Takashi Iwai
2006-10-05 10:43                           ` [Alsa-devel] " Takashi Iwai
2006-10-05 11:33                           ` [PATCH] Reset file->f_op in snd_card_file_remove (). " Karsten Wiese
2006-10-05 11:33                             ` [Alsa-devel] [PATCH] Reset file->f_op in snd_card_file_remove(). " Karsten Wiese
2006-10-05 14:12                             ` [PATCH] Reset file->f_op in snd_card_file_remove (). " Karsten Wiese
2006-10-05 14:12                               ` [Alsa-devel] [PATCH] Reset file->f_op in snd_card_file_remove(). " Karsten Wiese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.