From: Alexander Antonov <alexander.antonov@linux.intel.com>
To: Xiongfeng Wang <wangxiongfeng2@huawei.com>,
adrian.hunter@intel.com, peterz@infradead.org,
ak@linux.intel.com, kan.liang@linux.intel.com,
alexander.shishkin@linux.intel.com, acme@kernel.org,
jolsa@kernel.org
Cc: linux-perf-users@vger.kernel.org, yangyingliang@huawei.com
Subject: Re: [PATCH] perf/x86/intel/uncore: decrease reference count in error path
Date: Tue, 15 Nov 2022 17:25:31 +0100 [thread overview]
Message-ID: <3383249f-8ce1-e41f-c12d-484b24c8e061@linux.intel.com> (raw)
In-Reply-To: <20221115112515.53177-1-wangxiongfeng2@huawei.com>
On 11/15/2022 12:25 PM, Xiongfeng Wang wrote:
> pci_get_device() will increase the reference count for the returned
> pci_dev, and also decrease the reference count for the input parameter
> *from* if it is not NULL.
>
> If we break the loop in sad_cfg_iio_topology() with 'dev' not NULL. We
> need to use pci_dev_put() to decrease the reference count. Let's add it.
>
> Fixes: c1777be3646b ("perf/x86/intel/uncore: Enable I/O stacks to IIO PMON mapping on SNR")
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
> arch/x86/events/intel/uncore_snbep.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index ed869443efb2..83fe3d80c9a7 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -4469,6 +4469,7 @@ static int sad_cfg_iio_topology(struct intel_uncore_type *type, u8 *sad_pmon_map
> while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, SNR_ICX_MESH2IIO_MMAP_DID, dev))) {
> ret = pci_read_config_dword(dev, SNR_ICX_SAD_CONTROL_CFG, &sad_cfg);
> if (ret) {
> + pci_dev_put(dev);
> ret = pcibios_err_to_errno(ret);
> break;
> }
> @@ -4476,6 +4477,7 @@ static int sad_cfg_iio_topology(struct intel_uncore_type *type, u8 *sad_pmon_map
> die = uncore_pcibus_to_dieid(dev->bus);
> stack_id = SAD_CONTROL_STACK_ID(sad_cfg);
> if (die < 0 || stack_id >= type->num_boxes) {
> + pci_dev_put(dev);
> ret = -EPERM;
> break;
> }
Hi Xiongfeng,
Could you please update snr_uncore_mmio_map() and hswep_has_limit_sbox()
as well?
pci_dev_put() is missed there also
Thanks,
Alexander
prev parent reply other threads:[~2022-11-15 16:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 11:25 [PATCH] perf/x86/intel/uncore: decrease reference count in error path Xiongfeng Wang
2022-11-15 14:03 ` Liang, Kan
2022-11-15 16:25 ` Alexander Antonov [this message]
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=3383249f-8ce1-e41f-c12d-484b24c8e061@linux.intel.com \
--to=alexander.antonov@linux.intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--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.