From: David S. Miller Date: Sat, 20 Jan 2018 03:59:33 +0000 (-0500) Subject: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net X-Git-Tag: microblaze-4.16-rc6~157^2~110 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=8565d26bcb2ff6df646e946d2913fcf706d46b66;p=linux-2.6-microblaze.git Merge git://git./linux/kernel/git/davem/net The BPF verifier conflict was some minor contextual issue. The TUN conflict was less trivial. Cong Wang fixed a memory leak of tfile->tx_array in 'net'. This is an skb_array. But meanwhile in net-next tun changed tfile->tx_arry into tfile->tx_ring which is a ptr_ring. Signed-off-by: David S. Miller --- 8565d26bcb2ff6df646e946d2913fcf706d46b66 diff --cc drivers/net/tun.c index 170a3e89b5af,a8ec589d1359..698874684b4e --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@@ -679,6 -611,14 +679,15 @@@ static void tun_queue_purge(struct tun_ skb_queue_purge(&tfile->sk.sk_error_queue); } -static void tun_cleanup_tx_array(struct tun_file *tfile) ++static void tun_cleanup_tx_ring(struct tun_file *tfile) + { - if (tfile->tx_array.ring.queue) { - skb_array_cleanup(&tfile->tx_array); - memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); ++ if (tfile->tx_ring.queue) { ++ ptr_ring_cleanup(&tfile->tx_ring, tun_ptr_free); ++ xdp_rxq_info_unreg(&tfile->xdp_rxq); ++ memset(&tfile->tx_ring, 0, sizeof(tfile->tx_ring)); + } + } + static void __tun_detach(struct tun_file *tfile, bool clean) { struct tun_file *ntfile; @@@ -725,10 -665,7 +734,7 @@@ tun->dev->reg_state == NETREG_REGISTERED) unregister_netdevice(tun->dev); } - if (tun) { - ptr_ring_cleanup(&tfile->tx_ring, tun_ptr_free); - xdp_rxq_info_unreg(&tfile->xdp_rxq); - } - tun_cleanup_tx_array(tfile); ++ tun_cleanup_tx_ring(tfile); sock_put(&tfile->sk); } } @@@ -768,14 -706,14 +774,16 @@@ static void tun_detach_all(struct net_d tun_napi_del(tun, tfile); /* Drop read queue */ tun_queue_purge(tfile); + xdp_rxq_info_unreg(&tfile->xdp_rxq); sock_put(&tfile->sk); - tun_cleanup_tx_array(tfile); ++ tun_cleanup_tx_ring(tfile); } list_for_each_entry_safe(tfile, tmp, &tun->disabled, next) { tun_enable_queue(tfile); tun_queue_purge(tfile); + xdp_rxq_info_unreg(&tfile->xdp_rxq); sock_put(&tfile->sk); - tun_cleanup_tx_array(tfile); ++ tun_cleanup_tx_ring(tfile); } BUG_ON(tun->numdisabled != 0); @@@ -3145,6 -2860,8 +3153,8 @@@ static int tun_chr_open(struct inode *i sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); - memset(&tfile->tx_array, 0, sizeof(tfile->tx_array)); ++ memset(&tfile->tx_ring, 0, sizeof(tfile->tx_ring)); + return 0; } diff --cc kernel/bpf/verifier.c index 2e7a43edf264,13551e623501..8063dffd91a8 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@@ -5330,10 -4469,26 +5354,28 @@@ static int fixup_bpf_calls(struct bpf_v int i, cnt, delta = 0; for (i = 0; i < insn_cnt; i++, insn++) { + if (insn->code == (BPF_ALU | BPF_MOD | BPF_X) || + insn->code == (BPF_ALU | BPF_DIV | BPF_X)) { + /* due to JIT bugs clear upper 32-bits of src register + * before div/mod operation + */ + insn_buf[0] = BPF_MOV32_REG(insn->src_reg, insn->src_reg); + insn_buf[1] = *insn; + cnt = 2; + new_prog = bpf_patch_insn_data(env, i + delta, insn_buf, cnt); + if (!new_prog) + return -ENOMEM; + + delta += cnt - 1; + env->prog = prog = new_prog; + insn = new_prog->insnsi + i + delta; + continue; + } + if (insn->code != (BPF_JMP | BPF_CALL)) continue; + if (insn->src_reg == BPF_PSEUDO_CALL) + continue; if (insn->imm == BPF_FUNC_get_route_realm) prog->dst_needed = 1;