[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <564058e0-1432-676e-2f83-c8694911d8e5@iogearbox.net>
Date: Tue, 26 Feb 2019 15:44:39 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: zerons <sironhide0null@...il.com>, ast@...nel.org
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf: decrease usercnt if bpf_map_new_fd() fails in
bpf_map_get_fd_by_id()
On 02/26/2019 03:15 PM, zerons wrote:
> [ Upstream commit c91951f15978f1a0c6b65f063d30f7ea7bc6fb42 ]
Thanks for the fix! What do you mean by "upstream commit" above in this context?
> In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero() to increase
> the refcount, both map->refcnt and map->usercnt. Then, if bpf_map_new_fd() fails,
> should handle map->usercnt too.
>
> Signed-off-by: zerons <sironhide0null@...il.com>
> ---
> kernel/bpf/syscall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index cf5040f..db1ed12 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1966,7 +1966,7 @@ static int bpf_map_get_fd_by_id(const union bpf_attr *attr)
>
> fd = bpf_map_new_fd(map, f_flags);
> if (fd < 0)
> - bpf_map_put(map);
> + bpf_map_put_with_uref(map);
>
> return fd;
> }
> --
> 2.7.4
>
Powered by blists - more mailing lists