aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-02 14:09:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-02 14:09:41 -0400
commit8172ba51e257fdd353010cd7caaa37c8bc9eb44a (patch)
treedc440db5d27a9846a00a5ff011f5bd557b861051 /net
parentd4039314d0b1b57aa602490b7b9ae505e2467a44 (diff)
parentf5f321c43150cb4db8f342c8479c6fbdbe20b338 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix use-after-free with mac80211 RX A-MPDU reorder timer, from Johannes Berg. 2) iwlwifi leaks memory every module load/unload cycles, fix from Larry Finger. 3) Need to use for_each_netdev_safe() in rtnl_group_changelink() otherwise we can crash, from WANG Cong. 4) mlx4 driver does register_netdev() too early in the probe sequence, from Ido Shamay. 5) Don't allow router discovery hop limit to decrease the interface's hop limit, from D.S. Ljungmark. 6) tx_packets and tx_bytes improperly accounted for certain classes of USB network devices, fix from Ben Hutchings. 7) ip{6}mr_rules_init() mistakenly use plain kfree to release the ipmr tables in the error path, they must instead use ip{6}mr_free_table(). Fix from WANG Cong. 8) cxgb4 doesn't properly quiesce all RX activity before unregistering the netdevice. Fix from Hariprasad Shenai. 9) Fix hash corruptions in ipvlan driver, from Jiri Benc. 10) nla_memcpy(), like a real memcpy, should fully initialize the destination buffer, even if the source attribute is smaller. Fix from Jiri Benc. 11) Fix wrong error code returned from iucv_sock_sendmsg(). We should use whatever sock_alloc_send_skb() put into 'err'. From Eugene Crosser. 12) Fix slab object leak on module unload in TIPC, from Ying Xue. 13) Need a READ_ONCE() when reading the cached RX socket route in tcp_v{4,6}_early_demux(). From Michal Kubecek. 14) Still too many problems with TPC support in the ath9k driver, so disable it for now. From Felix Fietkau. 15) When in AP mode the rtlwifi driver can leak DMA mappings, fix from Larry Finger. 16) Missing kzalloc() failure check in gs_usb CAN driver, from Colin Ian King. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (52 commits) cxgb4: Fix to dump devlog, even if FW is crashed cxgb4: Firmware macro changes for fw verison 1.13.32.0 bnx2x: Fix kdump when iommu=on bnx2x: Fix kdump on 4-port device mac80211: fix RX A-MPDU session reorder timer deletion MAINTAINERS: Update Intel Wired Ethernet Driver info tipc: fix a slab object leak net/usb/r8152: add device id for Lenovo TP USB 3.0 Ethernet af_iucv: fix AF_IUCV sendmsg() errno openvswitch: Return vport module ref before destruction netlink: pad nla_memcpy dest buffer with zeroes bonding: Bonding Overriding Configuration logic restored. ipvlan: fix check for IP addresses in control path ipvlan: do not use rcu operations for address list ipvlan: protect against concurrent link removal ipvlan: fix addr hash list corruption net: fec: setup right value for mdio hold time net: tcp6: fix double call of tcp_v6_fill_cb() cxgb4vf: Fix sparse warnings netns: don't clear nsid too early on removal ...
Diffstat (limited to 'net')
-rw-r--r--net/core/net_namespace.c24
-rw-r--r--net/core/rtnetlink.c4
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv6/ip6mr.c2
-rw-r--r--net/ipv6/ndisc.c9
-rw-r--r--net/ipv6/tcp_ipv6.c13
-rw-r--r--net/iucv/af_iucv.c4
-rw-r--r--net/mac80211/agg-rx.c8
-rw-r--r--net/mac80211/rx.c7
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/openvswitch/vport.c4
-rw-r--r--net/tipc/core.c2
13 files changed, 55 insertions, 28 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index cb5290b8c428..5221f975a4cc 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -349,7 +349,7 @@ static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */
349static void cleanup_net(struct work_struct *work) 349static void cleanup_net(struct work_struct *work)
350{ 350{
351 const struct pernet_operations *ops; 351 const struct pernet_operations *ops;
352 struct net *net, *tmp; 352 struct net *net, *tmp, *peer;
353 struct list_head net_kill_list; 353 struct list_head net_kill_list;
354 LIST_HEAD(net_exit_list); 354 LIST_HEAD(net_exit_list);
355 355
@@ -365,14 +365,6 @@ static void cleanup_net(struct work_struct *work)
365 list_for_each_entry(net, &net_kill_list, cleanup_list) { 365 list_for_each_entry(net, &net_kill_list, cleanup_list) {
366 list_del_rcu(&net->list); 366 list_del_rcu(&net->list);
367 list_add_tail(&net->exit_list, &net_exit_list); 367 list_add_tail(&net->exit_list, &net_exit_list);
368 for_each_net(tmp) {
369 int id = __peernet2id(tmp, net, false);
370
371 if (id >= 0)
372 idr_remove(&tmp->netns_ids, id);
373 }
374 idr_destroy(&net->netns_ids);
375
376 } 368 }
377 rtnl_unlock(); 369 rtnl_unlock();
378 370
@@ -398,12 +390,26 @@ static void cleanup_net(struct work_struct *work)
398 */ 390 */
399 rcu_barrier(); 391 rcu_barrier();
400 392
393 rtnl_lock();
401 /* Finally it is safe to free my network namespace structure */ 394 /* Finally it is safe to free my network namespace structure */
402 list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) { 395 list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
396 /* Unreference net from all peers (no need to loop over
397 * net_exit_list because idr_destroy() will be called for each
398 * element of this list.
399 */
400 for_each_net(peer) {
401 int id = __peernet2id(peer, net, false);
402
403 if (id >= 0)
404 idr_remove(&peer->netns_ids, id);
405 }
406 idr_destroy(&net->netns_ids);
407
403 list_del_init(&net->exit_list); 408 list_del_init(&net->exit_list);
404 put_user_ns(net->user_ns); 409 put_user_ns(net->user_ns);
405 net_drop_ns(net); 410 net_drop_ns(net);
406 } 411 }
412 rtnl_unlock();
407} 413}
408static DECLARE_WORK(net_cleanup_work, cleanup_net); 414static DECLARE_WORK(net_cleanup_work, cleanup_net);
409 415
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ee0608bb3bc0..7ebed55b5f7d 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1932,10 +1932,10 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
1932 struct ifinfomsg *ifm, 1932 struct ifinfomsg *ifm,
1933 struct nlattr **tb) 1933 struct nlattr **tb)
1934{ 1934{
1935 struct net_device *dev; 1935 struct net_device *dev, *aux;
1936 int err; 1936 int err;
1937 1937
1938 for_each_netdev(net, dev) { 1938 for_each_netdev_safe(net, dev, aux) {
1939 if (dev->group == group) { 1939 if (dev->group == group) {
1940 err = do_setlink(skb, dev, ifm, tb, NULL, 0); 1940 err = do_setlink(skb, dev, ifm, tb, NULL, 0);
1941 if (err < 0) 1941 if (err < 0)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 9d78427652d2..92825443fad6 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -268,7 +268,7 @@ static int __net_init ipmr_rules_init(struct net *net)
268 return 0; 268 return 0;
269 269
270err2: 270err2:
271 kfree(mrt); 271 ipmr_free_table(mrt);
272err1: 272err1:
273 fib_rules_unregister(ops); 273 fib_rules_unregister(ops);
274 return err; 274 return err;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 5a2dfed4783b..f1756ee02207 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1518,7 +1518,7 @@ void tcp_v4_early_demux(struct sk_buff *skb)
1518 skb->sk = sk; 1518 skb->sk = sk;
1519 skb->destructor = sock_edemux; 1519 skb->destructor = sock_edemux;
1520 if (sk->sk_state != TCP_TIME_WAIT) { 1520 if (sk->sk_state != TCP_TIME_WAIT) {
1521 struct dst_entry *dst = sk->sk_rx_dst; 1521 struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst);
1522 1522
1523 if (dst) 1523 if (dst)
1524 dst = dst_check(dst, 0); 1524 dst = dst_check(dst, 0);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 34b682617f50..52028f449a89 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -252,7 +252,7 @@ static int __net_init ip6mr_rules_init(struct net *net)
252 return 0; 252 return 0;
253 253
254err2: 254err2:
255 kfree(mrt); 255 ip6mr_free_table(mrt);
256err1: 256err1:
257 fib_rules_unregister(ops); 257 fib_rules_unregister(ops);
258 return err; 258 return err;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 471ed24aabae..14ecdaf06bf7 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1218,7 +1218,14 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1218 if (rt) 1218 if (rt)
1219 rt6_set_expires(rt, jiffies + (HZ * lifetime)); 1219 rt6_set_expires(rt, jiffies + (HZ * lifetime));
1220 if (ra_msg->icmph.icmp6_hop_limit) { 1220 if (ra_msg->icmph.icmp6_hop_limit) {
1221 in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; 1221 /* Only set hop_limit on the interface if it is higher than
1222 * the current hop_limit.
1223 */
1224 if (in6_dev->cnf.hop_limit < ra_msg->icmph.icmp6_hop_limit) {
1225 in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
1226 } else {
1227 ND_PRINTK(2, warn, "RA: Got route advertisement with lower hop_limit than current\n");
1228 }
1222 if (rt) 1229 if (rt)
1223 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 1230 dst_metric_set(&rt->dst, RTAX_HOPLIMIT,
1224 ra_msg->icmph.icmp6_hop_limit); 1231 ra_msg->icmph.icmp6_hop_limit);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 5d46832c6f72..1f5e62229aaa 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1411,6 +1411,15 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr,
1411 TCP_SKB_CB(skb)->sacked = 0; 1411 TCP_SKB_CB(skb)->sacked = 0;
1412} 1412}
1413 1413
1414static void tcp_v6_restore_cb(struct sk_buff *skb)
1415{
1416 /* We need to move header back to the beginning if xfrm6_policy_check()
1417 * and tcp_v6_fill_cb() are going to be called again.
1418 */
1419 memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6,
1420 sizeof(struct inet6_skb_parm));
1421}
1422
1414static int tcp_v6_rcv(struct sk_buff *skb) 1423static int tcp_v6_rcv(struct sk_buff *skb)
1415{ 1424{
1416 const struct tcphdr *th; 1425 const struct tcphdr *th;
@@ -1543,6 +1552,7 @@ do_time_wait:
1543 inet_twsk_deschedule(tw, &tcp_death_row); 1552 inet_twsk_deschedule(tw, &tcp_death_row);
1544 inet_twsk_put(tw); 1553 inet_twsk_put(tw);
1545 sk = sk2; 1554 sk = sk2;
1555 tcp_v6_restore_cb(skb);
1546 goto process; 1556 goto process;
1547 } 1557 }
1548 /* Fall through to ACK */ 1558 /* Fall through to ACK */
@@ -1551,6 +1561,7 @@ do_time_wait:
1551 tcp_v6_timewait_ack(sk, skb); 1561 tcp_v6_timewait_ack(sk, skb);
1552 break; 1562 break;
1553 case TCP_TW_RST: 1563 case TCP_TW_RST:
1564 tcp_v6_restore_cb(skb);
1554 goto no_tcp_socket; 1565 goto no_tcp_socket;
1555 case TCP_TW_SUCCESS: 1566 case TCP_TW_SUCCESS:
1556 ; 1567 ;
@@ -1585,7 +1596,7 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
1585 skb->sk = sk; 1596 skb->sk = sk;
1586 skb->destructor = sock_edemux; 1597 skb->destructor = sock_edemux;
1587 if (sk->sk_state != TCP_TIME_WAIT) { 1598 if (sk->sk_state != TCP_TIME_WAIT) {
1588 struct dst_entry *dst = sk->sk_rx_dst; 1599 struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst);
1589 1600
1590 if (dst) 1601 if (dst)
1591 dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); 1602 dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 2e9953b2db84..53d931172088 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1114,10 +1114,8 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
1114 noblock, &err); 1114 noblock, &err);
1115 else 1115 else
1116 skb = sock_alloc_send_skb(sk, len, noblock, &err); 1116 skb = sock_alloc_send_skb(sk, len, noblock, &err);
1117 if (!skb) { 1117 if (!skb)
1118 err = -ENOMEM;
1119 goto out; 1118 goto out;
1120 }
1121 if (iucv->transport == AF_IUCV_TRANS_HIPER) 1119 if (iucv->transport == AF_IUCV_TRANS_HIPER)
1122 skb_reserve(skb, sizeof(struct af_iucv_trans_hdr) + ETH_HLEN); 1120 skb_reserve(skb, sizeof(struct af_iucv_trans_hdr) + ETH_HLEN);
1123 if (memcpy_from_msg(skb_put(skb, len), msg, len)) { 1121 if (memcpy_from_msg(skb_put(skb, len), msg, len)) {
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index a48bad468880..7702978a4c99 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -49,8 +49,6 @@ static void ieee80211_free_tid_rx(struct rcu_head *h)
49 container_of(h, struct tid_ampdu_rx, rcu_head); 49 container_of(h, struct tid_ampdu_rx, rcu_head);
50 int i; 50 int i;
51 51
52 del_timer_sync(&tid_rx->reorder_timer);
53
54 for (i = 0; i < tid_rx->buf_size; i++) 52 for (i = 0; i < tid_rx->buf_size; i++)
55 __skb_queue_purge(&tid_rx->reorder_buf[i]); 53 __skb_queue_purge(&tid_rx->reorder_buf[i]);
56 kfree(tid_rx->reorder_buf); 54 kfree(tid_rx->reorder_buf);
@@ -93,6 +91,12 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
93 91
94 del_timer_sync(&tid_rx->session_timer); 92 del_timer_sync(&tid_rx->session_timer);
95 93
94 /* make sure ieee80211_sta_reorder_release() doesn't re-arm the timer */
95 spin_lock_bh(&tid_rx->reorder_lock);
96 tid_rx->removed = true;
97 spin_unlock_bh(&tid_rx->reorder_lock);
98 del_timer_sync(&tid_rx->reorder_timer);
99
96 call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); 100 call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx);
97} 101}
98 102
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 944bdc04e913..1eb730bf8752 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -873,9 +873,10 @@ static void ieee80211_sta_reorder_release(struct ieee80211_sub_if_data *sdata,
873 873
874 set_release_timer: 874 set_release_timer:
875 875
876 mod_timer(&tid_agg_rx->reorder_timer, 876 if (!tid_agg_rx->removed)
877 tid_agg_rx->reorder_time[j] + 1 + 877 mod_timer(&tid_agg_rx->reorder_timer,
878 HT_RX_REORDER_BUF_TIMEOUT); 878 tid_agg_rx->reorder_time[j] + 1 +
879 HT_RX_REORDER_BUF_TIMEOUT);
879 } else { 880 } else {
880 del_timer(&tid_agg_rx->reorder_timer); 881 del_timer(&tid_agg_rx->reorder_timer);
881 } 882 }
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 925e68fe64c7..fb0fc1302a58 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -175,6 +175,7 @@ struct tid_ampdu_tx {
175 * @reorder_lock: serializes access to reorder buffer, see below. 175 * @reorder_lock: serializes access to reorder buffer, see below.
176 * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and 176 * @auto_seq: used for offloaded BA sessions to automatically pick head_seq_and
177 * and ssn. 177 * and ssn.
178 * @removed: this session is removed (but might have been found due to RCU)
178 * 179 *
179 * This structure's lifetime is managed by RCU, assignments to 180 * This structure's lifetime is managed by RCU, assignments to
180 * the array holding it must hold the aggregation mutex. 181 * the array holding it must hold the aggregation mutex.
@@ -199,6 +200,7 @@ struct tid_ampdu_rx {
199 u16 timeout; 200 u16 timeout;
200 u8 dialog_token; 201 u8 dialog_token;
201 bool auto_seq; 202 bool auto_seq;
203 bool removed;
202}; 204};
203 205
204/** 206/**
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index ec2954ffc690..067a3fff1d2c 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -274,10 +274,8 @@ void ovs_vport_del(struct vport *vport)
274 ASSERT_OVSL(); 274 ASSERT_OVSL();
275 275
276 hlist_del_rcu(&vport->hash_node); 276 hlist_del_rcu(&vport->hash_node);
277
278 vport->ops->destroy(vport);
279
280 module_put(vport->ops->owner); 277 module_put(vport->ops->owner);
278 vport->ops->destroy(vport);
281} 279}
282 280
283/** 281/**
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 935205e6bcfe..be1c9fa60b09 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -152,11 +152,11 @@ out_netlink:
152static void __exit tipc_exit(void) 152static void __exit tipc_exit(void)
153{ 153{
154 tipc_bearer_cleanup(); 154 tipc_bearer_cleanup();
155 unregister_pernet_subsys(&tipc_net_ops);
155 tipc_netlink_stop(); 156 tipc_netlink_stop();
156 tipc_netlink_compat_stop(); 157 tipc_netlink_compat_stop();
157 tipc_socket_stop(); 158 tipc_socket_stop();
158 tipc_unregister_sysctl(); 159 tipc_unregister_sysctl();
159 unregister_pernet_subsys(&tipc_net_ops);
160 160
161 pr_info("Deactivated\n"); 161 pr_info("Deactivated\n");
162} 162}