aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-01-14 17:17:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-01-14 17:17:37 -0500
commita6391a924cf5a16761ccd6b45094a7d5b9aeebac (patch)
treee428ed53a58c96d3da2fec562212c08d2d3b2385 /net
parent48c53db22032841290113799d43b24a677a4b24a (diff)
parentc637dbcedf31ce1dd813a461de406f45aa7a3d38 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Don't use uninitialized data in IPVS, from Dan Carpenter. 2) conntrack race fixes from Pablo Neira Ayuso. 3) Fix TX hangs with i40e, from Jesse Brandeburg. 4) Fix budget return from poll calls in dnet and alx, from Eric Dumazet. 5) Fix bugus "if (unlikely(x) < 0)" test in AF_PACKET, from Christoph Jaeger. 6) Fix bug introduced by conversion to list_head in TIPC retransmit code, from Jon Paul Maloy. 7) Don't use GFP_NOIO under spinlock in USB kaweth driver, from Alexey Khoroshilov. 8) Fix bridge build with INET disabled, from Arnd Bergmann. 9) Fix netlink array overrun for PROBE attributes in openvswitch, from Thomas Graf. 10) Don't hold spinlock across synchronize_irq() in tg3 driver, from Prashant Sreedharan. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits) tg3: Release tp->lock before invoking synchronize_irq() tg3: tg3_reset_task() needs to use rtnl_lock to synchronize tg3: tg3_timer() should grab tp->lock before checking for tp->irq_sync team: avoid possible underflow of count_pending value for notify_peers and mcast_rejoin openvswitch: packet messages need their own probe attribtue i40e: adds FCoE configure option cxgb4vf: Fix queue allocation for 40G adapter netdevice: Add missing parentheses in macro bridge: only provide proxy ARP when CONFIG_INET is enabled neighbour: fix base_reachable_time(_ms) not effective immediatly when changed net: fec: fix MDIO bus assignement for dual fec SoC's xen-netfront: use different locks for Rx and Tx stats drivers: net: cpsw: fix multicast flush in dual emac mode cxgb4vf: Initialize mdio_addr before using it net: Corrected the comment describing the ndo operations to reflect the actual prototype for couple of operations usb/kaweth: use GFP_ATOMIC under spin_lock in usb_start_wait_urb() MAINTAINERS: add me as ibmveth maintainer tipc: fix bug in broadcast retransmit code update ip-sysctl.txt documentation (v2) net/at91_ether: prepare and unprepare clock ...
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_input.c3
-rw-r--r--net/core/neighbour.c44
-rw-r--r--net/ipv4/netfilter/nft_redir_ipv4.c8
-rw-r--r--net/ipv6/netfilter/nft_redir_ipv6.c8
-rw-r--r--net/netfilter/ipvs/ip_vs_ftp.c10
-rw-r--r--net/netfilter/nf_conntrack_core.c20
-rw-r--r--net/netfilter/nf_tables_api.c14
-rw-r--r--net/netfilter/nfnetlink.c5
-rw-r--r--net/netfilter/nft_nat.c8
-rw-r--r--net/openvswitch/datapath.c3
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/tipc/bcast.c5
12 files changed, 90 insertions, 40 deletions
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 1f1de715197c..e2aa7be3a847 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -154,7 +154,8 @@ int br_handle_frame_finish(struct sk_buff *skb)
154 dst = NULL; 154 dst = NULL;
155 155
156 if (is_broadcast_ether_addr(dest)) { 156 if (is_broadcast_ether_addr(dest)) {
157 if (p->flags & BR_PROXYARP && 157 if (IS_ENABLED(CONFIG_INET) &&
158 p->flags & BR_PROXYARP &&
158 skb->protocol == htons(ETH_P_ARP)) 159 skb->protocol == htons(ETH_P_ARP))
159 br_do_proxy_arp(skb, br, vid); 160 br_do_proxy_arp(skb, br, vid);
160 161
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 8e38f17288d3..8d614c93f86a 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2043,6 +2043,12 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh)
2043 case NDTPA_BASE_REACHABLE_TIME: 2043 case NDTPA_BASE_REACHABLE_TIME:
2044 NEIGH_VAR_SET(p, BASE_REACHABLE_TIME, 2044 NEIGH_VAR_SET(p, BASE_REACHABLE_TIME,
2045 nla_get_msecs(tbp[i])); 2045 nla_get_msecs(tbp[i]));
2046 /* update reachable_time as well, otherwise, the change will
2047 * only be effective after the next time neigh_periodic_work
2048 * decides to recompute it (can be multiple minutes)
2049 */
2050 p->reachable_time =
2051 neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
2046 break; 2052 break;
2047 case NDTPA_GC_STALETIME: 2053 case NDTPA_GC_STALETIME:
2048 NEIGH_VAR_SET(p, GC_STALETIME, 2054 NEIGH_VAR_SET(p, GC_STALETIME,
@@ -2921,6 +2927,31 @@ static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write,
2921 return ret; 2927 return ret;
2922} 2928}
2923 2929
2930static int neigh_proc_base_reachable_time(struct ctl_table *ctl, int write,
2931 void __user *buffer,
2932 size_t *lenp, loff_t *ppos)
2933{
2934 struct neigh_parms *p = ctl->extra2;
2935 int ret;
2936
2937 if (strcmp(ctl->procname, "base_reachable_time") == 0)
2938 ret = neigh_proc_dointvec_jiffies(ctl, write, buffer, lenp, ppos);
2939 else if (strcmp(ctl->procname, "base_reachable_time_ms") == 0)
2940 ret = neigh_proc_dointvec_ms_jiffies(ctl, write, buffer, lenp, ppos);
2941 else
2942 ret = -1;
2943
2944 if (write && ret == 0) {
2945 /* update reachable_time as well, otherwise, the change will
2946 * only be effective after the next time neigh_periodic_work
2947 * decides to recompute it
2948 */
2949 p->reachable_time =
2950 neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
2951 }
2952 return ret;
2953}
2954
2924#define NEIGH_PARMS_DATA_OFFSET(index) \ 2955#define NEIGH_PARMS_DATA_OFFSET(index) \
2925 (&((struct neigh_parms *) 0)->data[index]) 2956 (&((struct neigh_parms *) 0)->data[index])
2926 2957
@@ -3047,6 +3078,19 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
3047 t->neigh_vars[NEIGH_VAR_RETRANS_TIME_MS].proc_handler = handler; 3078 t->neigh_vars[NEIGH_VAR_RETRANS_TIME_MS].proc_handler = handler;
3048 /* ReachableTime (in milliseconds) */ 3079 /* ReachableTime (in milliseconds) */
3049 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].proc_handler = handler; 3080 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].proc_handler = handler;
3081 } else {
3082 /* Those handlers will update p->reachable_time after
3083 * base_reachable_time(_ms) is set to ensure the new timer starts being
3084 * applied after the next neighbour update instead of waiting for
3085 * neigh_periodic_work to update its value (can be multiple minutes)
3086 * So any handler that replaces them should do this as well
3087 */
3088 /* ReachableTime */
3089 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME].proc_handler =
3090 neigh_proc_base_reachable_time;
3091 /* ReachableTime (in milliseconds) */
3092 t->neigh_vars[NEIGH_VAR_BASE_REACHABLE_TIME_MS].proc_handler =
3093 neigh_proc_base_reachable_time;
3050 } 3094 }
3051 3095
3052 /* Don't export sysctls to unprivileged users */ 3096 /* Don't export sysctls to unprivileged users */
diff --git a/net/ipv4/netfilter/nft_redir_ipv4.c b/net/ipv4/netfilter/nft_redir_ipv4.c
index ff2d23d8c87a..6ecfce63201a 100644
--- a/net/ipv4/netfilter/nft_redir_ipv4.c
+++ b/net/ipv4/netfilter/nft_redir_ipv4.c
@@ -27,10 +27,10 @@ static void nft_redir_ipv4_eval(const struct nft_expr *expr,
27 27
28 memset(&mr, 0, sizeof(mr)); 28 memset(&mr, 0, sizeof(mr));
29 if (priv->sreg_proto_min) { 29 if (priv->sreg_proto_min) {
30 mr.range[0].min.all = (__force __be16) 30 mr.range[0].min.all =
31 data[priv->sreg_proto_min].data[0]; 31 *(__be16 *)&data[priv->sreg_proto_min].data[0];
32 mr.range[0].max.all = (__force __be16) 32 mr.range[0].max.all =
33 data[priv->sreg_proto_max].data[0]; 33 *(__be16 *)&data[priv->sreg_proto_max].data[0];
34 mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 34 mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
35 } 35 }
36 36
diff --git a/net/ipv6/netfilter/nft_redir_ipv6.c b/net/ipv6/netfilter/nft_redir_ipv6.c
index 2433a6bfb191..11820b6b3613 100644
--- a/net/ipv6/netfilter/nft_redir_ipv6.c
+++ b/net/ipv6/netfilter/nft_redir_ipv6.c
@@ -27,10 +27,10 @@ static void nft_redir_ipv6_eval(const struct nft_expr *expr,
27 27
28 memset(&range, 0, sizeof(range)); 28 memset(&range, 0, sizeof(range));
29 if (priv->sreg_proto_min) { 29 if (priv->sreg_proto_min) {
30 range.min_proto.all = (__force __be16) 30 range.min_proto.all =
31 data[priv->sreg_proto_min].data[0]; 31 *(__be16 *)&data[priv->sreg_proto_min].data[0];
32 range.max_proto.all = (__force __be16) 32 range.max_proto.all =
33 data[priv->sreg_proto_max].data[0]; 33 *(__be16 *)&data[priv->sreg_proto_max].data[0];
34 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 34 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
35 } 35 }
36 36
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 1d5341f3761d..5d3daae98bf0 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
183 struct nf_conn *ct; 183 struct nf_conn *ct;
184 struct net *net; 184 struct net *net;
185 185
186 *diff = 0;
187
186#ifdef CONFIG_IP_VS_IPV6 188#ifdef CONFIG_IP_VS_IPV6
187 /* This application helper doesn't work with IPv6 yet, 189 /* This application helper doesn't work with IPv6 yet,
188 * so turn this into a no-op for IPv6 packets 190 * so turn this into a no-op for IPv6 packets
@@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
191 return 1; 193 return 1;
192#endif 194#endif
193 195
194 *diff = 0;
195
196 /* Only useful for established sessions */ 196 /* Only useful for established sessions */
197 if (cp->state != IP_VS_TCP_S_ESTABLISHED) 197 if (cp->state != IP_VS_TCP_S_ESTABLISHED)
198 return 1; 198 return 1;
@@ -322,6 +322,9 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
322 struct ip_vs_conn *n_cp; 322 struct ip_vs_conn *n_cp;
323 struct net *net; 323 struct net *net;
324 324
325 /* no diff required for incoming packets */
326 *diff = 0;
327
325#ifdef CONFIG_IP_VS_IPV6 328#ifdef CONFIG_IP_VS_IPV6
326 /* This application helper doesn't work with IPv6 yet, 329 /* This application helper doesn't work with IPv6 yet,
327 * so turn this into a no-op for IPv6 packets 330 * so turn this into a no-op for IPv6 packets
@@ -330,9 +333,6 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
330 return 1; 333 return 1;
331#endif 334#endif
332 335
333 /* no diff required for incoming packets */
334 *diff = 0;
335
336 /* Only useful for established sessions */ 336 /* Only useful for established sessions */
337 if (cp->state != IP_VS_TCP_S_ESTABLISHED) 337 if (cp->state != IP_VS_TCP_S_ESTABLISHED)
338 return 1; 338 return 1;
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index a11674806707..46d1b26a468e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -611,16 +611,15 @@ __nf_conntrack_confirm(struct sk_buff *skb)
611 */ 611 */
612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); 612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
613 pr_debug("Confirming conntrack %p\n", ct); 613 pr_debug("Confirming conntrack %p\n", ct);
614 /* We have to check the DYING flag inside the lock to prevent 614 /* We have to check the DYING flag after unlink to prevent
615 a race against nf_ct_get_next_corpse() possibly called from 615 * a race against nf_ct_get_next_corpse() possibly called from
616 user context, else we insert an already 'dead' hash, blocking 616 * user context, else we insert an already 'dead' hash, blocking
617 further use of that particular connection -JM */ 617 * further use of that particular connection -JM.
618 */
619 nf_ct_del_from_dying_or_unconfirmed_list(ct);
618 620
619 if (unlikely(nf_ct_is_dying(ct))) { 621 if (unlikely(nf_ct_is_dying(ct)))
620 nf_conntrack_double_unlock(hash, reply_hash); 622 goto out;
621 local_bh_enable();
622 return NF_ACCEPT;
623 }
624 623
625 /* See if there's one in the list already, including reverse: 624 /* See if there's one in the list already, including reverse:
626 NAT could have grabbed it without realizing, since we're 625 NAT could have grabbed it without realizing, since we're
@@ -636,8 +635,6 @@ __nf_conntrack_confirm(struct sk_buff *skb)
636 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) 635 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
637 goto out; 636 goto out;
638 637
639 nf_ct_del_from_dying_or_unconfirmed_list(ct);
640
641 /* Timer relative to confirmation time, not original 638 /* Timer relative to confirmation time, not original
642 setting time, otherwise we'd get timer wrap in 639 setting time, otherwise we'd get timer wrap in
643 weird delay cases. */ 640 weird delay cases. */
@@ -673,6 +670,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
673 return NF_ACCEPT; 670 return NF_ACCEPT;
674 671
675out: 672out:
673 nf_ct_add_to_dying_list(ct);
676 nf_conntrack_double_unlock(hash, reply_hash); 674 nf_conntrack_double_unlock(hash, reply_hash);
677 NF_CT_STAT_INC(net, insert_failed); 675 NF_CT_STAT_INC(net, insert_failed);
678 local_bh_enable(); 676 local_bh_enable();
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 129a8daa4abf..3b3ddb4fb9ee 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -713,16 +713,12 @@ static int nft_flush_table(struct nft_ctx *ctx)
713 struct nft_chain *chain, *nc; 713 struct nft_chain *chain, *nc;
714 struct nft_set *set, *ns; 714 struct nft_set *set, *ns;
715 715
716 list_for_each_entry_safe(chain, nc, &ctx->table->chains, list) { 716 list_for_each_entry(chain, &ctx->table->chains, list) {
717 ctx->chain = chain; 717 ctx->chain = chain;
718 718
719 err = nft_delrule_by_chain(ctx); 719 err = nft_delrule_by_chain(ctx);
720 if (err < 0) 720 if (err < 0)
721 goto out; 721 goto out;
722
723 err = nft_delchain(ctx);
724 if (err < 0)
725 goto out;
726 } 722 }
727 723
728 list_for_each_entry_safe(set, ns, &ctx->table->sets, list) { 724 list_for_each_entry_safe(set, ns, &ctx->table->sets, list) {
@@ -735,6 +731,14 @@ static int nft_flush_table(struct nft_ctx *ctx)
735 goto out; 731 goto out;
736 } 732 }
737 733
734 list_for_each_entry_safe(chain, nc, &ctx->table->chains, list) {
735 ctx->chain = chain;
736
737 err = nft_delchain(ctx);
738 if (err < 0)
739 goto out;
740 }
741
738 err = nft_deltable(ctx); 742 err = nft_deltable(ctx);
739out: 743out:
740 return err; 744 return err;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index cde4a6702fa3..c421d94c4652 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -321,7 +321,8 @@ replay:
321 nlh = nlmsg_hdr(skb); 321 nlh = nlmsg_hdr(skb);
322 err = 0; 322 err = 0;
323 323
324 if (nlh->nlmsg_len < NLMSG_HDRLEN) { 324 if (nlmsg_len(nlh) < sizeof(struct nfgenmsg) ||
325 skb->len < nlh->nlmsg_len) {
325 err = -EINVAL; 326 err = -EINVAL;
326 goto ack; 327 goto ack;
327 } 328 }
@@ -469,7 +470,7 @@ static int nfnetlink_bind(struct net *net, int group)
469 int type; 470 int type;
470 471
471 if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) 472 if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX)
472 return -EINVAL; 473 return 0;
473 474
474 type = nfnl_group2type[group]; 475 type = nfnl_group2type[group];
475 476
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index afe2b0b45ec4..aff54fb1c8a0 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -65,10 +65,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
65 } 65 }
66 66
67 if (priv->sreg_proto_min) { 67 if (priv->sreg_proto_min) {
68 range.min_proto.all = (__force __be16) 68 range.min_proto.all =
69 data[priv->sreg_proto_min].data[0]; 69 *(__be16 *)&data[priv->sreg_proto_min].data[0];
70 range.max_proto.all = (__force __be16) 70 range.max_proto.all =
71 data[priv->sreg_proto_max].data[0]; 71 *(__be16 *)&data[priv->sreg_proto_max].data[0];
72 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 72 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
73 } 73 }
74 74
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4e9a5f035cbc..b07349e82d78 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -524,7 +524,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
524 struct vport *input_vport; 524 struct vport *input_vport;
525 int len; 525 int len;
526 int err; 526 int err;
527 bool log = !a[OVS_FLOW_ATTR_PROBE]; 527 bool log = !a[OVS_PACKET_ATTR_PROBE];
528 528
529 err = -EINVAL; 529 err = -EINVAL;
530 if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] || 530 if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
@@ -610,6 +610,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
610 [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN }, 610 [OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
611 [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED }, 611 [OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
612 [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED }, 612 [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
613 [OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG },
613}; 614};
614 615
615static const struct genl_ops dp_packet_genl_ops[] = { 616static const struct genl_ops dp_packet_genl_ops[] = {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 6880f34a529a..9cfe2e1dd8b5 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2517,7 +2517,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
2517 err = -EINVAL; 2517 err = -EINVAL;
2518 if (sock->type == SOCK_DGRAM) { 2518 if (sock->type == SOCK_DGRAM) {
2519 offset = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, len); 2519 offset = dev_hard_header(skb, dev, ntohs(proto), addr, NULL, len);
2520 if (unlikely(offset) < 0) 2520 if (unlikely(offset < 0))
2521 goto out_free; 2521 goto out_free;
2522 } else { 2522 } else {
2523 if (ll_header_truncated(dev, len)) 2523 if (ll_header_truncated(dev, len))
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 96ceefeb9daf..a9e174fc0f91 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -220,10 +220,11 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
220 struct sk_buff *skb; 220 struct sk_buff *skb;
221 221
222 skb_queue_walk(&bcl->outqueue, skb) { 222 skb_queue_walk(&bcl->outqueue, skb) {
223 if (more(buf_seqno(skb), after)) 223 if (more(buf_seqno(skb), after)) {
224 tipc_link_retransmit(bcl, skb, mod(to - after));
224 break; 225 break;
226 }
225 } 227 }
226 tipc_link_retransmit(bcl, skb, mod(to - after));
227} 228}
228 229
229/** 230/**