From: sashiko-bot@kernel.org
To: "Vinay Belgaumkar" <vinay.belgaumkar@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v6 1/2] perf: Fix null pointer access in is_include_guest_event()
Date: Wed, 02 Sep 2026 14:35:22 +0000 [thread overview]
Message-ID: <20260902143522.69E531F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902141824.733112-2-vinay.belgaumkar@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message claims that `READ_ONCE` was added to `is_include_guest_event()` for checking the `pmu` state, but the code lacks this instruction.
--
commit 7c0504a46d493eec58eae8ca000ce324320508fd
Author: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
perf: Fix null pointer access in is_include_guest_event()
This commit addresses a null pointer dereference in is_include_guest_event()
caused by a module unload occurring while a perf connection is active. It adds
a null check for the pmu pointer and calls mediated_pmu_unaccount_event()
before clearing the pointer to maintain the event counts correctly.
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index a6c8e38a31104..7777e82aad5e7 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -6350,6 +6350,9 @@ static DEFINE_MUTEX(perf_mediated_pmu_mutex);
> /* !exclude_guest event of PMU with PERF_PMU_CAP_MEDIATED_VPMU */
> static inline bool is_include_guest_event(struct perf_event *event)
> {
> + if (!event->pmu)
> + return false;
> +
> if ((event->pmu->capabilities & PERF_PMU_CAP_MEDIATED_VPMU) &&
[Severity: Medium]
The commit message claims that READ_ONCE was added for checking the pmu state,
but the code lacks this instruction here.
Without READ_ONCE(), the compiler is free to issue two independent memory loads
of event->pmu: one for the null check and one for accessing capabilities.
Could this leave a potential double-read hazard if event->pmu is concurrently
nullified by __pmu_detach_event() while is_include_guest_event() is executing?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902141824.733112-1-vinay.belgaumkar@intel.com?part=1
next prev parent reply other threads:[~2026-09-02 14:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 14:18 [PATCH v6 0/2] perf: Add some null ptr checks Vinay Belgaumkar
2026-09-02 14:18 ` [PATCH v6 1/2] perf: Fix null pointer access in is_include_guest_event() Vinay Belgaumkar
2026-09-02 14:35 ` sashiko-bot [this message]
2026-09-02 14:18 ` [PATCH v6 2/2] perf: Add checks to prevent null ptr access Vinay Belgaumkar
2026-09-02 14:41 ` sashiko-bot
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=20260902143522.69E531F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vinay.belgaumkar@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox