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