bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: Change kvfree to kfree in generic_map_lookup_batch()
@ 2020-06-01 16:28 Denis Efremov
  2020-06-01 20:17 ` Song Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Efremov @ 2020-06-01 16:28 UTC (permalink / raw)
  To: Alexei Starovoitov, Martin KaFai Lau; +Cc: Denis Efremov, bpf, linux-kernel

buf_prevkey in generic_map_lookup_batch() is allocated with
kmalloc(). It's safe to free it with kfree().

Signed-off-by: Denis Efremov <efremov@linux.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 4e6dee19a668..10bb622be5b6 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1383,7 +1383,7 @@ int generic_map_lookup_batch(struct bpf_map *map,
 
 	buf = kmalloc(map->key_size + value_size, GFP_USER | __GFP_NOWARN);
 	if (!buf) {
-		kvfree(buf_prevkey);
+		kfree(buf_prevkey);
 		return -ENOMEM;
 	}
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: Change kvfree to kfree in generic_map_lookup_batch()
  2020-06-01 16:28 [PATCH] bpf: Change kvfree to kfree in generic_map_lookup_batch() Denis Efremov
@ 2020-06-01 20:17 ` Song Liu
  2020-06-01 21:37   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: Song Liu @ 2020-06-01 20:17 UTC (permalink / raw)
  To: Denis Efremov; +Cc: Alexei Starovoitov, Martin KaFai Lau, bpf, open list

On Mon, Jun 1, 2020 at 9:29 AM Denis Efremov <efremov@linux.com> wrote:
>
> buf_prevkey in generic_map_lookup_batch() is allocated with
> kmalloc(). It's safe to free it with kfree().
>
> Signed-off-by: Denis Efremov <efremov@linux.com>

Please add prefix "PATCH bpf" or "PATCH bpf-next" to indicate which
tree this should
apply to. This one looks more like for bpf-next, as current code still
works. For patches
to bpf-next, we should wait after the merge window.

Also, maybe add:

Fixes: cb4d03ab499d ("bpf: Add generic support for lookup batch op")

Acked-by: Song Liu <songliubraving@fb.com>

Thanks,
Song

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: Change kvfree to kfree in generic_map_lookup_batch()
  2020-06-01 20:17 ` Song Liu
@ 2020-06-01 21:37   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-06-01 21:37 UTC (permalink / raw)
  To: Song Liu
  Cc: Denis Efremov, Alexei Starovoitov, Martin KaFai Lau, bpf, open list

On Mon, Jun 1, 2020 at 1:18 PM Song Liu <song@kernel.org> wrote:
>
> On Mon, Jun 1, 2020 at 9:29 AM Denis Efremov <efremov@linux.com> wrote:
> >
> > buf_prevkey in generic_map_lookup_batch() is allocated with
> > kmalloc(). It's safe to free it with kfree().
> >
> > Signed-off-by: Denis Efremov <efremov@linux.com>
>
> Please add prefix "PATCH bpf" or "PATCH bpf-next" to indicate which
> tree this should
> apply to. This one looks more like for bpf-next, as current code still
> works. For patches
> to bpf-next, we should wait after the merge window.
>
> Also, maybe add:
>
> Fixes: cb4d03ab499d ("bpf: Add generic support for lookup batch op")
>
> Acked-by: Song Liu <songliubraving@fb.com>

Applied to bpf-next. Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-01 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 16:28 [PATCH] bpf: Change kvfree to kfree in generic_map_lookup_batch() Denis Efremov
2020-06-01 20:17 ` Song Liu
2020-06-01 21:37   ` Alexei Starovoitov

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).