aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/net/ebpf_jit.c2
-rw-r--r--kernel/bpf/syscall.c6
-rw-r--r--kernel/bpf/verifier.c3
3 files changed, 6 insertions, 5 deletions
diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c
index 76e9bf88d3b9..0effd3cba9a7 100644
--- a/arch/mips/net/ebpf_jit.c
+++ b/arch/mips/net/ebpf_jit.c
@@ -1819,7 +1819,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
1819 1819
1820 /* Update the icache */ 1820 /* Update the icache */
1821 flush_icache_range((unsigned long)ctx.target, 1821 flush_icache_range((unsigned long)ctx.target,
1822 (unsigned long)(ctx.target + ctx.idx * sizeof(u32))); 1822 (unsigned long)&ctx.target[ctx.idx]);
1823 1823
1824 if (bpf_jit_enable > 1) 1824 if (bpf_jit_enable > 1)
1825 /* Dump JIT code */ 1825 /* Dump JIT code */
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 8577bb7f8be6..84470d1480aa 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -559,12 +559,12 @@ static int map_create(union bpf_attr *attr)
559 err = bpf_map_new_fd(map, f_flags); 559 err = bpf_map_new_fd(map, f_flags);
560 if (err < 0) { 560 if (err < 0) {
561 /* failed to allocate fd. 561 /* failed to allocate fd.
562 * bpf_map_put() is needed because the above 562 * bpf_map_put_with_uref() is needed because the above
563 * bpf_map_alloc_id() has published the map 563 * bpf_map_alloc_id() has published the map
564 * to the userspace and the userspace may 564 * to the userspace and the userspace may
565 * have refcnt-ed it through BPF_MAP_GET_FD_BY_ID. 565 * have refcnt-ed it through BPF_MAP_GET_FD_BY_ID.
566 */ 566 */
567 bpf_map_put(map); 567 bpf_map_put_with_uref(map);
568 return err; 568 return err;
569 } 569 }
570 570
@@ -1986,7 +1986,7 @@ static int bpf_map_get_fd_by_id(const union bpf_attr *attr)
1986 1986
1987 fd = bpf_map_new_fd(map, f_flags); 1987 fd = bpf_map_new_fd(map, f_flags);
1988 if (fd < 0) 1988 if (fd < 0)
1989 bpf_map_put(map); 1989 bpf_map_put_with_uref(map);
1990 1990
1991 return fd; 1991 return fd;
1992} 1992}
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 8f295b790297..5fcce2f4209d 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -6920,7 +6920,8 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
6920 u32 off_reg; 6920 u32 off_reg;
6921 6921
6922 aux = &env->insn_aux_data[i + delta]; 6922 aux = &env->insn_aux_data[i + delta];
6923 if (!aux->alu_state) 6923 if (!aux->alu_state ||
6924 aux->alu_state == BPF_ALU_NON_POINTER)
6924 continue; 6925 continue;
6925 6926
6926 isneg = aux->alu_state & BPF_ALU_NEG_VALUE; 6927 isneg = aux->alu_state & BPF_ALU_NEG_VALUE;