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 3/4] perf/x86/intel/uncore: Fix reference count leak in snr_uncore_mmio_map()
Date: Thu, 17 Nov 2022 08:27:37 -0500 [thread overview]
Message-ID: <1ca7d49a-c3c7-32b2-29ea-7e086c514b97@linux.intel.com> (raw)
In-Reply-To: <20221117094336.10846-4-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, so snr_uncore_get_mc_dev() will return a pci_dev with its
> reference count increased. We need to call pci_dev_put() to decrease the
> reference count before exiting from snr_uncore_mmio_map(). Add
> pci_dev_put() for both normal and error path.
>
> Fixes: ee49532b38dd ("perf/x86/intel/uncore: Add IMC uncore support for Snow Ridge")
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
> arch/x86/events/intel/uncore_snbep.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index 3fc484045ed6..0481f5135cb1 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -4866,9 +4866,12 @@ static int snr_uncore_mmio_map(struct intel_uncore_box *box,
Similar to the previous comments.
I think we can release the dev immediately once when we do not use it
anymore. So we don't need to patch it everywhere later.
Thanks,
Kan
> box->io_addr = ioremap(addr, type->mmio_map_size);
> if (!box->io_addr) {
> pr_warn("perf uncore: Failed to ioremap for %s.\n", type->name);
> + pci_dev_put(pdev);
> return -EINVAL;
> }
>
> + pci_dev_put(pdev);
> +
> return 0;
> }
>
next prev parent reply other threads:[~2022-11-17 13:28 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
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 [this message]
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=1ca7d49a-c3c7-32b2-29ea-7e086c514b97@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.