Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030673AbWJDJWl (ORCPT ); Wed, 4 Oct 2006 05:22:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030548AbWJDJWk (ORCPT ); Wed, 4 Oct 2006 05:22:40 -0400 Received: from ns2.suse.de ([195.135.220.15]:721 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1030673AbWJDJWk (ORCPT ); Wed, 4 Oct 2006 05:22:40 -0400 Date: Wed, 04 Oct 2006 11:22:34 +0200 Message-ID: From: Takashi Iwai To: Karsten Wiese Cc: linux-kernel@vger.kernel.org, alsa-devel@lists.sourceforge.net, mingo@elte.hu Subject: Re: [PATCH] Reset file->f_op in snd_card_file_remove(). Take 2 In-Reply-To: <200610012029.36694.annabellesgarden@yahoo.de> References: <200609282228.02611.annabellesgarden@yahoo.de> <200609291429.21183.annabellesgarden@yahoo.de> <200610012029.36694.annabellesgarden@yahoo.de> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta25) (eggplant) (+CVS-20060326) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2952 Lines: 86 At Sun, 1 Oct 2006 20:29:36 +0200, Karsten Wiese wrote: > > Am Freitag, 29. September 2006 14:45 schrieb Takashi Iwai: > > At Fri, 29 Sep 2006 14:29:20 +0200, > > Karsten Wiese wrote: > > > > > > Am Freitag, 29. September 2006 12:48 schrieb Takashi Iwai: > > > > At Thu, 28 Sep 2006 22:28:02 +0200, > > > > Karsten Wiese wrote: > > > > > > > > > > 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 > > > > > > > > I guess this bug is fixed by Florin's patch below, juding from your > > > > explanation. Could you check it? > > > > > > > Florin's patch fixes it. > > > > > > This one for immediate consumation by mainline, mm, rt, > > > and the stable teams, hmm? > > > > It'll be pushed to mainline soon together with other ALSA fixes. Then > > I'll forward to stable, too. > > > bug is back. Florin's patch _is_ right. > And installed, unless im getting confuzed. > To help me proove, > please consider this controll of flow: > > usb disconnect > > usX2Y_usb_disconnect() calls snd_card_free(card); It should call snd_card_free_when_closed() instead. Takashi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/