Message ID | 20221229072534.1381432-1-linmq006@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2277049wrt; Wed, 28 Dec 2022 23:32:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXvj1Ai0LKtD8UaJ4ndq51ow+PcSECUutRtpljLZWrxlIxaFKPX0hfdUP0Xg5OaPg0grClP9 X-Received: by 2002:a17:90a:77c5:b0:219:b330:7f6d with SMTP id e5-20020a17090a77c500b00219b3307f6dmr31216708pjs.24.1672299141153; Wed, 28 Dec 2022 23:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672299141; cv=none; d=google.com; s=arc-20160816; b=wC8Ryd3kK1PExnr546K2vnaONzUX+AVbbHt37EJcpxFkLSCNnH7vzj9ML7WC7LSb9C xS/CYB6uRKnWLr9ZNsyGNs5obODbbT+eLvfNd4u/erWWoaXoQNaWC4xy1XJhgIZ7U8Wo ShgARsvGHtD0tKs4b+DUJXAVDf308SAKGhbWbv9So/RBXI3UO8aI/kkwPhkx6xUO+SOi zZNgcgf1t9/VWcdy7VhhFVcxJNSN8WCfLtpQH0XhePasI22PvvgxWfvTo7SzL+wBIu/l BwTMizKQPHJfz23C3eqAxkC+GLDXx0MHiT16J0DR5q7dqKgzpQGTDYCZsgznWKRmgmwN g/zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XMmjpNuQhfnjEBg0iRS3fgyiOsvlVGYZtXowsGaPpY4=; b=CJYgc4jsChKz+KQjw3LBZZJEjDZ/jGTvEjlnWAzBqNOHdpFylyMimL763rRPRxbecs 7eNXqdvQqI313MuSCYGS7ZxZZZyD0RgGFTc8vBx3+vEKHnvA/YMyDGe54txCifxftHde 766s0HZhf9tFN59h6o9w3IcirzR+wz2GmdgXOJGOlTUzxM3mmXYXEL5uOlkcbfippM0O Ufv755yFI/19Dms1XZ9CGvuzOuMjQpp//lYWfpcGOmIUs0pAcw641rlYIJEMF4N19++C oLSGQHVUwyOSitZ63FUEDofsKya6vdkDVIOz0DqcnLD3DRDTVzqOWgYlH+7ljV8vmAXX bIRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XlJp8yXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a17090a4b0700b00212ce534ef7si17441684pjh.22.2022.12.28.23.32.08; Wed, 28 Dec 2022 23:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XlJp8yXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232960AbiL2HZr (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Thu, 29 Dec 2022 02:25:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbiL2HZo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 29 Dec 2022 02:25:44 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AAD72BB; Wed, 28 Dec 2022 23:25:43 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id m4so18205739pls.4; Wed, 28 Dec 2022 23:25:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XMmjpNuQhfnjEBg0iRS3fgyiOsvlVGYZtXowsGaPpY4=; b=XlJp8yXFhT4hyvoX3Uk/oVEkgPHpakO9wCFNHG7R0VHAyFMOK0J1Q2LuhOdzSiSfKB gvwpJfIHFJ+N43entFnS6WXbYcGG5XYdV+8DCVQvaEDBs6Qu6d1PKtWZxtzjMx0sitV9 hHqdNA2vhCqTJ6O9pfRjp3Rr+sBf+mjU8pvEmvqRq0taocaHms2P+sywRMj9jHhfBAsh X9mTxQc6X6KTe5fv2WsnB+IUl3+EhHmeJ82UiHg6WRxfkb7NvuVUzTzSk7XadnPp0R8o sTVVfXMI+XI/1CAzVJO+0oesbfqiNOlQNEDKp4yAhDHf2o7Ls6Dfyn/GWNGuV89Cagjn eaFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XMmjpNuQhfnjEBg0iRS3fgyiOsvlVGYZtXowsGaPpY4=; b=BeSCSo59uSDydeohBi482jUinFyxMgjTHmbaIdRn53yzEjkfN2JMIhvJzYL//MEpQT RzlGByD2gLcDOJeK3oub+NP6MqsKYcbPalubLtPrEZhFGYDuDCIdKRwYY7C1DXokgOPF rGnsjIjYB7JG1HDyisjoR2my2e+An14koygp6ousAgImUEbLbZp3k5Cmdm/rJtYIN1UF zQzO5TEeO1Jfun1O0ZcZ0713I0yLU8KKgmkeag/s41dIJKlhovTT1+1cOUGnraxDYNZ5 Z7S1nRSp1hLP3xZwWBvfJUHv/0LD2QiRAECUiBzURht5DuP/DVT1ZdEw11vsjwq+aaHF Ttyw== X-Gm-Message-State: AFqh2kpPa3eeScKf4u6JjkXwToDm8clU0Tp4wG3syE7prDAolysK6pC5 yHE07ieKiGgF9XQOauPV2Hc= X-Received: by 2002:a17:90a:c24a:b0:225:f3e6:424e with SMTP id d10-20020a17090ac24a00b00225f3e6424emr13350914pjx.17.1672298743124; Wed, 28 Dec 2022 23:25:43 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id f62-20020a17090a28c400b00225c9afdba4sm9052116pjd.38.2022.12.28.23.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 23:25:42 -0800 (PST) From: Miaoqian Lin <linmq006@gmail.com> To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, Sanket Goswami <Sanket.Goswami@amd.com>, Mario Limonciello <mario.limonciello@amd.com>, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH] platform/x86/amd: Fix refcount leak in amd_pmc_probe Date: Thu, 29 Dec 2022 11:25:33 +0400 Message-Id: <20221229072534.1381432-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753532744292578084?= X-GMAIL-MSGID: =?utf-8?q?1753532744292578084?= |
Series |
platform/x86/amd: Fix refcount leak in amd_pmc_probe
|
|
Commit Message
Miaoqian Lin
Dec. 29, 2022, 7:25 a.m. UTC
pci_get_domain_bus_and_slot() takes reference, the caller should release
the reference by calling pci_dev_put() after use. Call pci_dev_put() in
the error path to fix this.
Fixes: 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to DRAM STB feature")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/platform/x86/amd/pmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
[Public] > -----Original Message----- > From: Miaoqian Lin <linmq006@gmail.com> > Sent: Thursday, December 29, 2022 01:26 > To: S-k, Shyam-sundar <Shyam-sundar.S-k@amd.com>; Hans de Goede > <hdegoede@redhat.com>; Mark Gross <markgross@kernel.org>; Goswami, > Sanket <Sanket.Goswami@amd.com>; Limonciello, Mario > <Mario.Limonciello@amd.com>; platform-driver-x86@vger.kernel.org; linux- > kernel@vger.kernel.org > Cc: linmq006@gmail.com > Subject: [PATCH] platform/x86/amd: Fix refcount leak in amd_pmc_probe > > pci_get_domain_bus_and_slot() takes reference, the caller should release > the reference by calling pci_dev_put() after use. Call pci_dev_put() in > the error path to fix this. > > Fixes: 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to > DRAM STB feature") > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Makes sense to me, thanks! Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> > --- > drivers/platform/x86/amd/pmc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/amd/pmc.c > b/drivers/platform/x86/amd/pmc.c > index 439d282aafd1..8d924986381b 100644 > --- a/drivers/platform/x86/amd/pmc.c > +++ b/drivers/platform/x86/amd/pmc.c > @@ -932,7 +932,7 @@ static int amd_pmc_probe(struct platform_device > *pdev) > if (enable_stb && (dev->cpu_id == AMD_CPU_ID_YC || dev->cpu_id > == AMD_CPU_ID_CB)) { > err = amd_pmc_s2d_init(dev); > if (err) > - return err; > + goto err_pci_dev_put; > } > > platform_set_drvdata(pdev, dev); > -- > 2.25.1
Hi, On 12/29/22 08:25, Miaoqian Lin wrote: > pci_get_domain_bus_and_slot() takes reference, the caller should release > the reference by calling pci_dev_put() after use. Call pci_dev_put() in > the error path to fix this. > > Fixes: 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to DRAM STB feature") > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Thank you for your patch, I've applied this patch to my fixes branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes Note it will show up in my fixes branch once I've pushed my local branch there, which might take a while. I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle. Regards, Hans > --- > drivers/platform/x86/amd/pmc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c > index 439d282aafd1..8d924986381b 100644 > --- a/drivers/platform/x86/amd/pmc.c > +++ b/drivers/platform/x86/amd/pmc.c > @@ -932,7 +932,7 @@ static int amd_pmc_probe(struct platform_device *pdev) > if (enable_stb && (dev->cpu_id == AMD_CPU_ID_YC || dev->cpu_id == AMD_CPU_ID_CB)) { > err = amd_pmc_s2d_init(dev); > if (err) > - return err; > + goto err_pci_dev_put; > } > > platform_set_drvdata(pdev, dev);
diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c index 439d282aafd1..8d924986381b 100644 --- a/drivers/platform/x86/amd/pmc.c +++ b/drivers/platform/x86/amd/pmc.c @@ -932,7 +932,7 @@ static int amd_pmc_probe(struct platform_device *pdev) if (enable_stb && (dev->cpu_id == AMD_CPU_ID_YC || dev->cpu_id == AMD_CPU_ID_CB)) { err = amd_pmc_s2d_init(dev); if (err) - return err; + goto err_pci_dev_put; } platform_set_drvdata(pdev, dev);