diff mbox series

[v2,bpf-next] bpf: Fix an error code in check_btf_func()

Message ID 20200604085436.GA943001@mwanda
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [v2,bpf-next] bpf: Fix an error code in check_btf_func() | expand

Commit Message

Dan Carpenter June 4, 2020, 8:54 a.m. UTC
This code returns success if the "info_aux" allocation fails 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>
---
v2: style change

 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Song Liu June 4, 2020, 6:37 p.m. UTC | #1
On Thu, Jun 4, 2020 at 1:55 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> This code returns success if the "info_aux" allocation fails 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>

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

> ---
> v2: style change
>
Daniel Borkmann June 4, 2020, 9:43 p.m. UTC | #2
On 6/4/20 8:37 PM, Song Liu wrote:
> On Thu, Jun 4, 2020 at 1:55 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>
>> This code returns success if the "info_aux" allocation fails 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>
> 
> Acked-by: Song Liu <songliubraving@fb.com>

Applied, thanks (my personal style preference would have been v1, but fair enough).
diff mbox series

Patch

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 5c7bbaac81ef9..34cde841ab681 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -7552,7 +7552,7 @@  static int check_btf_func(struct bpf_verifier_env *env,
 	const struct btf *btf;
 	void __user *urecord;
 	u32 prev_offset = 0;
-	int ret = 0;
+	int ret = -ENOMEM;
 
 	nfuncs = attr->func_info_cnt;
 	if (!nfuncs)