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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50DDFC2D0BF for ; Tue, 10 Dec 2019 13:50:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A4702077B for ; Tue, 10 Dec 2019 13:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbfLJNuD (ORCPT ); Tue, 10 Dec 2019 08:50:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:46134 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727007AbfLJNuC (ORCPT ); Tue, 10 Dec 2019 08:50:02 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DD710AD6C; Tue, 10 Dec 2019 13:50:00 +0000 (UTC) Date: Tue, 10 Dec 2019 14:50:00 +0100 Message-ID: From: Takashi Iwai To: Nicholas Johnson Cc: Lukas Wunner , Jaroslav Kysela , Alex Deucher , Mika Westerberg , Bjorn Helgaas , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" Subject: Re: [PATCH] ALSA: hda/hdmi - Fix duplicate unref of pci_dev In-Reply-To: References: <77aa6c01aefe1ebc4004e87b0bc714f2759f15c4.1575985006.git.lukas@wunner.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Dec 2019 14:47:28 +0100, Nicholas Johnson wrote: > > On Tue, Dec 10, 2019 at 02:39:50PM +0100, Lukas Wunner wrote: > > Nicholas Johnson reports a null pointer deref as well as a refcount > > underflow upon hot-removal of a Thunderbolt-attached AMD eGPU. > > He's bisected the issue down to commit 586bc4aab878 ("ALSA: hda/hdmi - > > fix vgaswitcheroo detection for AMD"). > > > > The commit iterates over PCI devices using pci_get_class() and > > unreferences each device found, even though pci_get_class() > > subsequently unreferences the device as well. Fix it. > > > > Fixes: 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD") > > Link: https://lore.kernel.org/r/PSXP216MB0438BFEAA0617283A834E11580580@PSXP216MB0438.KORP216.PROD.OUTLOOK.COM/ > > Reported-and-tested-by: Nicholas Johnson > > Signed-off-by: Lukas Wunner > > Cc: Mika Westerberg > > Cc: Alexander Deucher > > Cc: Bjorn Helgaas > > --- > > sound/pci/hda/hda_intel.c | 1 - > > 1 file changed, 1 deletion(-) > > > > 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; > > } > > -- > > 2.24.0 > > > Extremely fast turnaround from bisect to patch. > > If you want the bugzilla.kernel.org report then I can do that ASAP, but > I feel that it is redundant now. We have now Link tag to track the ML archive, so it should suffice, I suppose. > Thank you for handling my bug report. And thank you for your quick testing. Takashi