Re: [PATCH v2 5/5] uprobes: make uprobe_register() return struct uprobe *

From: Jiri Olsa
Date: Thu Aug 01 2024 - 09:14:20 EST


On Thu, Aug 01, 2024 at 02:26:45PM +0200, Oleg Nesterov wrote:
> On 08/01, Jiri Olsa wrote:
> >
> > > Note the additional path_put() in testmod_unregister_uprobe(). Does it need
> > > a separate patch or can it come with 5/5 ?
> >
> > I think it'd be better to have it separately, the test is already
> > released.. so people might want to backport just the fix
>
> OK, I'll rebase and add the patch below to v4. OK?

heh, suggested-by would have been fine, but sure ;-)

thanks,
jirka

>
> Oleg.
> ---
>
> From f6bf42015048938d826880e3bf4a318bb64a05b4 Mon Sep 17 00:00:00 2001
> From: Oleg Nesterov <oleg@xxxxxxxxxx>
> Date: Thu, 1 Aug 2024 14:21:47 +0200
> Subject: [PATCH] selftests/bpf: fix uprobe.path leak in bpf_testmod
>
> From: Jiri Olsa <olsajiri@xxxxxxxxx>
>
> testmod_unregister_uprobe() forgets to path_put(&uprobe.path).
>
> Signed-off-by: Jiri Olsa <olsajiri@xxxxxxxxx>
> Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
> ---
> tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> index 86babdd6f850..55f6905de743 100644
> --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> @@ -477,6 +477,7 @@ static void testmod_unregister_uprobe(void)
> if (uprobe.offset) {
> uprobe_unregister(d_real_inode(uprobe.path.dentry),
> uprobe.offset, &uprobe.consumer);
> + path_put(&uprobe.path);
> uprobe.offset = 0;
> }
>
> --
> 2.25.1.362.g51ebf55
>
>