Thread (3 messages) flat view 3 messages, 3 authors, 2021-07-15

Re: [bpf-next, v2] bpf: verifier: Fix potential memleak and UAF in bpf verifier

From: Alexei Starovoitov <hidden>
Date: 2021-07-15 01:34:34
Also in: bpf, lkml

On Wed, Jul 14, 2021 at 5:54 PM Song Liu [off-list ref] wrote:
quoted
-       return 0;
+       return;
No need to say return here.
quoted
 }

 static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len)
@@ -11492,6 +11490,14 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of
                                            const struct bpf_insn *patch, u32 len)
 {
        struct bpf_prog *new_prog;
+       struct bpf_insn_aux_data *new_data = NULL;
+
+       if (len > 1) {
+               new_data = vzalloc(array_size(env->prog->len + len - 1,
+                                             sizeof(struct bpf_insn_aux_data)));
+               if (!new_data)
+                       return NULL;
I removed the redundant 'return' that Song pointed out and the
redundant 'if' above.
And applied to bpf-next.
Though it's a fix, I think it's ok to go via bpf-next, since even
syzbot didn't find it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help