Re: Linux v5.5 serious PCI bug

From: Takashi Iwai
Date: Tue Dec 10 2019 - 07:46:50 EST


On Tue, 10 Dec 2019 13:29:41 +0100,
Lukas Wunner wrote:
>
> [cc += Alex, Takashi]
>
> On Tue, Dec 10, 2019 at 12:00:23PM +0000, Nicholas Johnson wrote:
> > On Tue, Dec 10, 2019 at 09:28:00AM +0200, mika.westerberg@xxxxxxxxxxxxxxx wrote:
> > > On Mon, Dec 09, 2019 at 01:33:49PM +0000, Nicholas Johnson wrote:
> > > > On Mon, Dec 09, 2019 at 03:12:39PM +0200, mika.westerberg@xxxxxxxxxxxxxxx wrote:
> > > > > On Mon, Dec 09, 2019 at 12:34:04PM +0000, Nicholas Johnson wrote:
> > > > > > I have compiled Linux v5.5-rc1 and thought all was good until I
> > > > > > hot-removed a Gigabyte Aorus eGPU from Thunderbolt. The driver for the
> > > > > > GPU was not loaded (blacklisted) so the crash is nothing to do with the
> > > > > > GPU driver.
> > > > > >
> > > > > > We had:
> > > > > > - kernel NULL pointer dereference
> > > > > > - refcount_t: underflow; use-after-free.
> >
> > The following is the culprit responsible for the issues:
> >
> > commit 586bc4aab878efcf672536f0cdec3d04b6990c94
> > Author: Alex Deucher <alexander.deucher@xxxxxxx>
> > Date: Fri Nov 22 16:43:50 2019 -0500
> >
> > ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD
>
> Does the below fix the issue?
>
> -- >8 --
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index 35b4526f0d28..b856b89378ac 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -1419,7 +1419,6 @@ static bool atpx_present(void)
> return true;
> }
> }
> - pci_dev_put(pdev);
> }
> return false;
> }

Oh this looks really like a bug, even if this isn't the root cause.

Care to submit a proper patch?


thanks,

Takashi