Hi, Sasha
On Mon, Nov 22, 2021 at 1:25 AM Sasha Levin <sashal(a)kernel.org> wrote:
>
> This is a note to let you know that I've just added the patch titled
>
> perf bench: Fix two memory leaks detected with ASan
>
> to the 4.9-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
>
> The filename of the patch is:
> perf-bench-fix-two-memory-leaks-detected-with-asan.patch
> and it can be found in the queue-4.9 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable(a)vger.kernel.org> know about it.
>
>
I think this patch should not be added to the stable tree. I think
this patch should be reverted soon.
Thanks,
- Sohaib
>
> commit b1c29e2248629770cee7ac88cb9dfea91e07146b
> Author: Sohaib Mohamed <sohaib.amhmd(a)gmail.com>
> Date: Wed Nov 10 04:20:11 2021 +0200
>
> perf bench: Fix two memory leaks detected with ASan
>
> [ Upstream commit 92723ea0f11d92496687db8c9725248e9d1e5e1d ]
>
> ASan reports memory leaks while running:
>
> $ perf bench sched all
>
> Fixes: e27454cc6352c422 ("perf bench: Add sched-messaging.c: Benchmark for scheduler and IPC mechanisms based on hackbench")
> Signed-off-by: Sohaib Mohamed <sohaib.amhmd(a)gmail.com>
> Acked-by: Ian Rogers <irogers(a)google.com>
> Cc: Alexander Shishkin <alexander.shishkin(a)linux.intel.com>
> Cc: Hitoshi Mitake <h.mitake(a)gmail.com>
> Cc: Jiri Olsa <jolsa(a)redhat.com>
> Cc: Mark Rutland <mark.rutland(a)arm.com>
> Cc: Namhyung Kim <namhyung(a)kernel.org>
> Cc: Paul Russel <rusty(a)rustcorp.com.au>
> Cc: Peter Zijlstra <peterz(a)infradead.org>
> Cc: Pierre Gondois <pierre.gondois(a)arm.com>
> Link: http://lore.kernel.org/lkml/20211110022012.16620-1-sohaib.amhmd@gmail.com
> Signed-off-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
> Signed-off-by: Sasha Levin <sashal(a)kernel.org>
>
> diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
> index 6a111e775210f..9322fd166bdaf 100644
> --- a/tools/perf/bench/sched-messaging.c
> +++ b/tools/perf/bench/sched-messaging.c
> @@ -225,6 +225,8 @@ static unsigned int group(pthread_t *pth,
> snd_ctx->out_fds[i] = fds[1];
> if (!thread_mode)
> close(fds[0]);
> +
> + free(ctx);
> }
>
> /* Now we have all the fds, fork the senders */
> @@ -241,6 +243,8 @@ static unsigned int group(pthread_t *pth,
> for (i = 0; i < num_fds; i++)
> close(snd_ctx->out_fds[i]);
>
> + free(snd_ctx);
> +
> /* Return number of children to reap */
> return num_fds * 2;
> }