linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: linux-trace-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@kernel.org, oleg@redhat.com, rostedt@goodmis.org,
	mhiramat@kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, jolsa@kernel.org,
	liaochang1@huawei.com, kernel-team@meta.com
Subject: Re: [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance()
Date: Mon, 9 Dec 2024 20:13:26 +0900	[thread overview]
Message-ID: <20241209201326.31f5e339f70302f80c641c88@kernel.org> (raw)
In-Reply-To: <20241206183436.968068-1-andrii@kernel.org>

On Fri,  6 Dec 2024 10:34:36 -0800
Andrii Nakryiko <andrii@kernel.org> wrote:

> If kmemdup() failed to alloc memory, don't proceed with extra_consumers
> copy.
> 
> Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thanks!

> ---
>  kernel/events/uprobes.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 1af950208c2b..1f75a2f91206 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
>  	struct return_instance *ri;
>  
>  	ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
> +	if (!ri)
> +		return NULL;
>  
>  	if (unlikely(old->cons_cnt > 1)) {
>  		ri->extra_consumers = kmemdup(old->extra_consumers,
> -- 
> 2.43.5
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2024-12-09 11:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06 18:34 [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance() Andrii Nakryiko
2024-12-09 11:13 ` Masami Hiramatsu [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=20241209201326.31f5e339f70302f80c641c88@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=liaochang1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).