From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C172BEE4993 for ; Wed, 23 Aug 2023 16:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237449AbjHWQNp (ORCPT ); Wed, 23 Aug 2023 12:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234317AbjHWQNo (ORCPT ); Wed, 23 Aug 2023 12:13:44 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD56CD6 for ; Wed, 23 Aug 2023 09:13:38 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5D73520931; Wed, 23 Aug 2023 16:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692807217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jwNPIlXO1cZROk1bqLcvHXeSLn6/7q5ucl311GCvZ9s=; b=ML/JHayOof9oF9g58EMq30h5KwiW4v8QN4lIlrE6HUzqEJBEtJSwkrtBdHVWLFoRe4RdAl VKeuVFmWffNyQaBI2dHs3RsAx8Qa46zaqKyzq7F3pLTcr6+4fQbQjC/7RHpIIib5RMcLJf Hn3GXhvapfz119lcFfO7bufDJZ9wIRo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692807217; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jwNPIlXO1cZROk1bqLcvHXeSLn6/7q5ucl311GCvZ9s=; b=hs6icawUeUaqdnSo4AuosAVSPbx3Jr66UxFUBgP2sm7Q4cUy0uj2C1QYJPxV8H2GkR1swt Os+fCO9yhxyrT+CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 24FFE13458; Wed, 23 Aug 2023 16:13:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id g/cQCDEw5mSOPgAAMHmgww (envelope-from ); Wed, 23 Aug 2023 16:13:37 +0000 Date: Wed, 23 Aug 2023 18:13:36 +0200 Message-ID: <87fs49d9e7.wl-tiwai@suse.de> From: Takashi Iwai To: Takashi Yano Cc: Takashi Iwai , gregkh@linuxfoundation.org, patches@lists.linux.dev, sashal@kernel.org, stable@vger.kernel.org, tasos@tasossah.com Subject: Re: [PATCH 6.1 110/181] ALSA: ymfpci: Create card with device-managed snd_devm_card_new() In-Reply-To: <20230824004533.eef5bfded08b8af05f71bee9@nifty.ne.jp> References: <20230403140418.679274299@linuxfoundation.org> <20230823135846.1812-1-takashi.yano@nifty.ne.jp> <87h6ophml0.wl-tiwai@suse.de> <20230824004533.eef5bfded08b8af05f71bee9@nifty.ne.jp> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, 23 Aug 2023 17:45:33 +0200, Takashi Yano wrote: > > On Wed, 23 Aug 2023 16:15:07 +0200 > Takashi Iwai wrote: > > On Wed, 23 Aug 2023 15:58:46 +0200, > > Takashi Yano wrote: > > > > > > Dear Linux Kernel Team, > > > > > > I had encountered the problem that I reported to debian kernel team: > > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050117 > > > , where I was suggested to report this to upstream. > > > > > > After a lot of struggle, I found that this issue occurs after the following > > > commit. The problem happens if a YAMAHA YMF7x4 sound card is present AND the > > > firmware is missing. Not only the shutdown/reboot problem, but the page fault, > > > whose error log is being cited following the commit, also occurs in the boot > > > process. > > (snip) > > > I looked into this problem and found the mechanism of the page fault. > > > > > > 1) chip->reg_area_virt is mapped in sound/pci/ymfpci/ymfpci_main.c: > > > snd_ymfpci_create() in the initialize process of snd_ymfpci. > > > 2) The initializing fails due to a lack of the firmware. > > > 3) The allocated resources are released in drivers/base/devres.c: > > > release_nodes(). > > > 4) In the release process 3), reg_area_virt is unmapped before calling > > > sound/pci/ymfpci/ymfpci_main.c: snd_ymfpci_free(). > > > 5) The first register access in sound/pci/ymfpci/ymfpci_main.c: > > > snd_ymfpci_free() causes page fault because the reg_area_virt is > > > already unmapped. > > > > > > Unfortunately, I am not familiar with the linux kernel code, so I am not > > > sure of the appropriate way how the problem should be fixed. > > > > Thanks for the report and the analysis. Yes, it's the problem of the > > device release, and this driver was overlooked while it's been fixed in > > a few others. > > > > Below is the fix patch. Let me know if it works for you, then I'll > > submit to the upstream and let stable branch backporting it later. > > Thank you for your amazingly quick reply. :) > I have confirmed that the following patch solves the problem. > With this patch, snd_ymfpci_free() no longer seems to be called in > the release process on error. > > Thank you so much for your help. Thanks for quick testing. I'll submit and merge for the upstream. Takashi