Re: Linux v5.5 serious PCI bug

From: Nicholas Johnson
Date: Tue Dec 10 2019 - 07:52:38 EST


On Tue, Dec 10, 2019 at 01:29:41PM +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;
> }
Yes, removing the pci_dev_put() as above solves the issue.

Thanks.

Kind regards,
Nicholas.