BPF List
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Dan Carpenter <error27@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Dave Marchevsky <davemarchevsky@meta.com>
Subject: [PATCH bpf-next v8 01/22] bpf: Fix early return in map_check_btf
Date: Thu, 17 Nov 2022 21:54:09 +0530	[thread overview]
Message-ID: <20221117162430.1213770-2-memxor@gmail.com> (raw)
In-Reply-To: <20221117162430.1213770-1-memxor@gmail.com>

Instead of returning directly with -EOPNOTSUPP for the timer case, we
need to free the btf_record before returning to userspace.

Fixes: db559117828d ("bpf: Consolidate spin_lock, timer management into btf_record")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.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 fdbae52f463f..0b48e2b13021 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1010,7 +1010,7 @@ static int map_check_btf(struct bpf_map *map, const struct btf *btf,
 				if (map->map_type != BPF_MAP_TYPE_HASH &&
 				    map->map_type != BPF_MAP_TYPE_LRU_HASH &&
 				    map->map_type != BPF_MAP_TYPE_ARRAY) {
-					return -EOPNOTSUPP;
+					ret = -EOPNOTSUPP;
 					goto free_map_tab;
 				}
 				break;
-- 
2.38.1


  reply	other threads:[~2022-11-17 16:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 16:24 [PATCH bpf-next v8 00/22] Allocated objects, BPF linked lists Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` Kumar Kartikeya Dwivedi [this message]
2022-11-17 16:24 ` [PATCH bpf-next v8 02/22] bpf: Do btf_record_free outside map_free callback Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 03/22] bpf: Do btf_record_free for outer maps Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 04/22] bpf: Populate field_offs for inner_map_meta Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 05/22] bpf: Introduce allocated objects support Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 06/22] bpf: Recognize lock and list fields in allocated objects Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 07/22] bpf: Verify ownership relationships for user BTF types Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 08/22] bpf: Allow locking bpf_spin_lock in allocated objects Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 09/22] bpf: Allow locking bpf_spin_lock global variables Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 10/22] bpf: Allow locking bpf_spin_lock in inner map values Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 11/22] bpf: Rewrite kfunc argument handling Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 12/22] bpf: Support constant scalar arguments for kfuncs Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 13/22] bpf: Introduce bpf_obj_new Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 14/22] bpf: Introduce bpf_obj_drop Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 15/22] bpf: Permit NULL checking pointer with non-zero fixed offset Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 16/22] bpf: Introduce single ownership BPF linked list API Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 17/22] bpf: Add 'release on unlock' logic for bpf_list_push_{front,back} Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 18/22] selftests/bpf: Add __contains macro to bpf_experimental.h Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 19/22] selftests/bpf: Update spinlock selftest Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 20/22] selftests/bpf: Add failure test cases for spin lock pairing Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 21/22] selftests/bpf: Add BPF linked list API tests Kumar Kartikeya Dwivedi
2022-11-17 16:24 ` [PATCH bpf-next v8 22/22] selftests/bpf: Add BTF sanity tests Kumar Kartikeya Dwivedi

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=20221117162430.1213770-2-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davemarchevsky@meta.com \
    --cc=error27@gmail.com \
    --cc=martin.lau@kernel.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