From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: mdshahid03@gmail.com, maddy@linux.ibm.com
Cc: mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org,
sshegde@linux.ibm.com, atrajeev@linux.ibm.com,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Mohammad Shahid <mdshahid03@gmail.com>,
Tanushree Shah <tshah@linux.ibm.com>
Subject: Re: [PATCH v2] powerpc/perf: vpa-dtl: fix resource leak on allocation failure
Date: Fri, 27 Nov 2026 19:46:53 +0530 [thread overview]
Message-ID: <5wxiwe96.ritesh.list@gmail.com> (raw)
In-Reply-To: <20261127052345.23361-1-mdshahid03@gmail.com>
mdshahid03@gmail.com writes:
> From: Mohammad Shahid <mdshahid03@gmail.com>
>
> vpa_dtl_event_init() allocates the DTL buffer while holding
> dtl_global_lock. Move the allocation before acquiring the spinlock
> to avoid performing memory allocation while holding a spinlock.
>
> Since the buffer is allocated before acquiring dtl_access_lock
> allocation failure can be returned directly without releasing the
> semaphore.
>
> Free the allocated buffer if acquiring dtl_access_lock fails.
>
> Fixes: 4708fba19ade ("powerpc/vpa_dtl: Add interface to expose vpa dtl counters via perf")
> Suggested-by: Athira Rajeev <atrajeev@linux.ibm.com>
>
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> ---
> arch/powerpc/perf/vpa-dtl.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
I am unable to apply this patch on any of the upstream trees.
Could you please rebase your patch on top of powerpc/next-test [2]?
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/log/?h=next-test
>
> diff --git a/arch/powerpc/perf/vpa-dtl.c b/arch/powerpc/perf/vpa-dtl.c
> index 20eafeaffa6b..57bc5773949f 100644
> --- a/arch/powerpc/perf/vpa-dtl.c
> +++ b/arch/powerpc/perf/vpa-dtl.c
> @@ -338,7 +338,7 @@ static int vpa_dtl_mem_alloc(int cpu)
> if (!dtl_cache)
> return -ENOMEM;
>
> - buf = kmem_cache_alloc_node(dtl_cache, GFP_KERNEL | GFP_ATOMIC, cpu_to_node(cpu));
> + buf = kmem_cache_alloc_node(dtl_cache, GFP_KERNEL, cpu_to_node(cpu));
E.g. in this commit [1], we already had changed this above allocation to
GFP_ATOMIC, which is even merged in mainline. So it seems your base tree
is old. Please rebase your changes to powerpc/next-test as pointed above
and resend.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9500416c8aa7c271b85be6a0d5856da62b60223a
-ritesh
prev parent reply other threads:[~2026-11-27 14:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 5:23 [PATCH v2] powerpc/perf: vpa-dtl: fix resource leak on allocation failure mdshahid03
2026-11-27 14:16 ` Ritesh Harjani [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=5wxiwe96.ritesh.list@gmail.com \
--to=ritesh.list@gmail.com \
--cc=atrajeev@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mdshahid03@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=sshegde@linux.ibm.com \
--cc=tshah@linux.ibm.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