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 87AADC2D0BF for ; Tue, 10 Dec 2019 13:41:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DC462073D for ; Tue, 10 Dec 2019 13:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727426AbfLJNlM (ORCPT ); Tue, 10 Dec 2019 08:41:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:41722 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727131AbfLJNlL (ORCPT ); Tue, 10 Dec 2019 08:41:11 -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 D7D78AD7B; Tue, 10 Dec 2019 13:41:09 +0000 (UTC) Date: Tue, 10 Dec 2019 14:41:08 +0100 Message-ID: From: Takashi Iwai To: Lukas Wunner Cc: Jaroslav Kysela , Alex Deucher , Mika Westerberg , Bjorn Helgaas , Nicholas Johnson , 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: <77aa6c01aefe1ebc4004e87b0bc714f2759f15c4.1575985006.git.lukas@wunner.de> 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:39:50 +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 Applied now. Thanks. Takashi > --- > 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 >