From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Xiongfeng Wang <wangxiongfeng2@huawei.com>,
adrian.hunter@intel.com, peterz@infradead.org,
ak@linux.intel.com, alexander.shishkin@linux.intel.com,
alexander.antonov@linux.intel.com, acme@kernel.org,
jolsa@kernel.org
Cc: linux-perf-users@vger.kernel.org, yangyingliang@huawei.com
Subject: Re: [PATCH v4 2/4] perf/x86/intel/uncore: Fix reference count leak in hswep_has_limit_sbox()
Date: Thu, 17 Nov 2022 08:23:26 -0500 [thread overview]
Message-ID: <e2dabe13-d5f2-e1d8-f846-964e5cd3fa51@linux.intel.com> (raw)
In-Reply-To: <20221117094336.10846-3-wangxiongfeng2@huawei.com>
On 2022-11-17 4:43 a.m., Xiongfeng Wang wrote:
> pci_get_device() will increase the reference count for the returned
> pci_dev. We need to call pci_dev_put() to decrease the reference count
> before exiting from hswep_has_limit_sbox(). Add pci_dev_put() for both
> normal and error path.
>
> Fixes: 9d480158ee86 ("perf/x86/intel/uncore: Remove uncore extra PCI dev HSWEP_PCI_PCU_3")
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
> arch/x86/events/intel/uncore_snbep.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index 76fedc8e12dd..3fc484045ed6 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -2891,8 +2891,12 @@ static bool hswep_has_limit_sbox(unsigned int device)
> return false;
>
> pci_read_config_dword(dev, HSWEP_PCU_CAPID4_OFFET, &capid4);
I think we can move the pci_dev_put here to avoid patching it twice.
Thanks,
Kan
> - if (!hswep_get_chop(capid4))
> + if (!hswep_get_chop(capid4)) {
> + pci_dev_put(dev);
> return true;
> + }
> +
> + pci_dev_put(dev);
>
> return false;
> }
next prev parent reply other threads:[~2022-11-17 13:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 9:43 [PATCH v4 0/4] perf/x86/intel/uncore: Fix PCI device reference count leak Xiongfeng Wang
2022-11-17 9:43 ` [PATCH v4 1/4] perf/x86/intel/uncore: Fix reference count leak in sad_cfg_iio_topology() Xiongfeng Wang
2022-11-17 9:43 ` [PATCH v4 2/4] perf/x86/intel/uncore: Fix reference count leak in hswep_has_limit_sbox() Xiongfeng Wang
2022-11-17 13:23 ` Liang, Kan [this message]
2022-11-17 9:43 ` [PATCH v4 3/4] perf/x86/intel/uncore: Fix reference count leak in snr_uncore_mmio_map() Xiongfeng Wang
2022-11-17 13:27 ` Liang, Kan
2022-11-17 9:43 ` [PATCH v4 4/4] perf/x86/intel/uncore: Fix reference count leak in __uncore_imc_init_box() Xiongfeng Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e2dabe13-d5f2-e1d8-f846-964e5cd3fa51@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.antonov@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=wangxiongfeng2@huawei.com \
--cc=yangyingliang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.