aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-03-02 00:48:08 -0500
committerDavid S. Miller <davem@davemloft.net>2019-03-02 00:48:08 -0500
commitf08d6114b7a907b4a99522008ffc0140e08dbc56 (patch)
treeb313508ea7ae0e175006478fc0b57ce4e23865fc
parented8fe20205ac054bf585156709de3913d1890f30 (diff)
parent3612af783cf52c74a031a2f11b82247b2599d3cd (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Alexei Starovoitov says: ==================== pull-request: bpf 2019-03-01 The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) fix sanitation rewrite, from Daniel. 2) fix error path on map_new_fd, from Peng. 3) fix icache flush address, from Paul. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-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;