kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Fix an error code in check_btf_func()
@ 2020-06-03 17:55 Dan Carpenter
  2020-06-03 17:57 ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2020-06-03 17:55 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
	Andrii Nakryiko, John Fastabend, KP Singh, bpf, kernel-janitors

This code returns success if kcalloc() but it should return -ENOMEM.

Fixes: 8c1b6e69dcc1 ("bpf: Compare BTF types of functions arguments with actual types")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 kernel/bpf/verifier.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 5c7bbaac81ef9..25363f134bf0c 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -7581,8 +7581,10 @@ static int check_btf_func(struct bpf_verifier_env *env,
 	if (!krecord)
 		return -ENOMEM;
 	info_aux = kcalloc(nfuncs, sizeof(*info_aux), GFP_KERNEL | __GFP_NOWARN);
-	if (!info_aux)
+	if (!info_aux) {
+		ret = -ENOMEM;
 		goto err_free;
+	}
 
 	for (i = 0; i < nfuncs; i++) {
 		ret = bpf_check_uarg_tail_zero(urecord, krec_size, urec_size);
-- 
2.26.2

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 17:55 [PATCH bpf-next] bpf: Fix an error code in check_btf_func() Dan Carpenter
2020-06-03 17:57 ` Alexei Starovoitov
2020-06-04  8:54   ` [PATCH v2 " Dan Carpenter
2020-06-04 18:37     ` Song Liu
2020-06-04 21:43       ` Daniel Borkmann

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