aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ax25/af_ax25.c9
-rw-r--r--net/bluetooth/hci_core.c7
-rw-r--r--net/bluetooth/l2cap_core.c3
-rw-r--r--net/bluetooth/l2cap_sock.c5
-rw-r--r--net/bluetooth/mgmt.c13
-rw-r--r--net/bridge/br_multicast.c81
-rw-r--r--net/bridge/br_private.h4
-rw-r--r--net/caif/chnl_net.c9
-rw-r--r--net/core/dev.c20
-rw-r--r--net/core/drop_monitor.c1
-rw-r--r--net/core/net_namespace.c33
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c12
-rw-r--r--net/ipv4/tcp.c15
-rw-r--r--net/ipv4/tcp_input.c10
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv6/addrconf.c9
-rw-r--r--net/ipv6/ip6_fib.c9
-rw-r--r--net/ipv6/ndisc.c3
-rw-r--r--net/ipv6/netfilter/ip6_tables.c14
-rw-r--r--net/ipv6/route.c71
-rw-r--r--net/ipv6/tcp_ipv6.c6
-rw-r--r--net/key/af_key.c2
-rw-r--r--net/l2tp/l2tp_ip.c5
-rw-r--r--net/mac80211/ibss.c4
-rw-r--r--net/mac80211/mlme.c3
-rw-r--r--net/mac80211/rx.c10
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c4
-rw-r--r--net/nfc/llcp/commands.c4
-rw-r--r--net/phonet/pn_dev.c21
-rw-r--r--net/sched/sch_gred.c7
-rw-r--r--net/sunrpc/sunrpc_syms.c17
-rw-r--r--net/wireless/nl80211.c31
-rw-r--r--net/wireless/util.c2
-rw-r--r--net/wireless/wext-core.c6
37 files changed, 213 insertions, 248 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 0906c194a41..9d9a6a3edbd 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -2011,16 +2011,17 @@ static void __exit ax25_exit(void)
2011 proc_net_remove(&init_net, "ax25_route"); 2011 proc_net_remove(&init_net, "ax25_route");
2012 proc_net_remove(&init_net, "ax25"); 2012 proc_net_remove(&init_net, "ax25");
2013 proc_net_remove(&init_net, "ax25_calls"); 2013 proc_net_remove(&init_net, "ax25_calls");
2014 ax25_rt_free();
2015 ax25_uid_free();
2016 ax25_dev_free();
2017 2014
2018 ax25_unregister_sysctl();
2019 unregister_netdevice_notifier(&ax25_dev_notifier); 2015 unregister_netdevice_notifier(&ax25_dev_notifier);
2016 ax25_unregister_sysctl();
2020 2017
2021 dev_remove_pack(&ax25_packet_type); 2018 dev_remove_pack(&ax25_packet_type);
2022 2019
2023 sock_unregister(PF_AX25); 2020 sock_unregister(PF_AX25);
2024 proto_unregister(&ax25_proto); 2021 proto_unregister(&ax25_proto);
2022
2023 ax25_rt_free();
2024 ax25_uid_free();
2025 ax25_dev_free();
2025} 2026}
2026module_exit(ax25_exit); 2027module_exit(ax25_exit);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e33af63a884..92a857e3786 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -665,6 +665,11 @@ int hci_dev_open(__u16 dev)
665 665
666 hci_req_lock(hdev); 666 hci_req_lock(hdev);
667 667
668 if (test_bit(HCI_UNREGISTER, &hdev->dev_flags)) {
669 ret = -ENODEV;
670 goto done;
671 }
672
668 if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) { 673 if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) {
669 ret = -ERFKILL; 674 ret = -ERFKILL;
670 goto done; 675 goto done;
@@ -1849,6 +1854,8 @@ void hci_unregister_dev(struct hci_dev *hdev)
1849 1854
1850 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); 1855 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
1851 1856
1857 set_bit(HCI_UNREGISTER, &hdev->dev_flags);
1858
1852 write_lock(&hci_dev_list_lock); 1859 write_lock(&hci_dev_list_lock);
1853 list_del(&hdev->list); 1860 list_del(&hdev->list);
1854 write_unlock(&hci_dev_list_lock); 1861 write_unlock(&hci_dev_list_lock);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index b8e17e4dac8..94552b33d52 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1308,6 +1308,7 @@ static void l2cap_monitor_timeout(struct work_struct *work)
1308 if (chan->retry_count >= chan->remote_max_tx) { 1308 if (chan->retry_count >= chan->remote_max_tx) {
1309 l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); 1309 l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED);
1310 l2cap_chan_unlock(chan); 1310 l2cap_chan_unlock(chan);
1311 l2cap_chan_put(chan);
1311 return; 1312 return;
1312 } 1313 }
1313 1314
@@ -1316,6 +1317,7 @@ static void l2cap_monitor_timeout(struct work_struct *work)
1316 1317
1317 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); 1318 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
1318 l2cap_chan_unlock(chan); 1319 l2cap_chan_unlock(chan);
1320 l2cap_chan_put(chan);
1319} 1321}
1320 1322
1321static void l2cap_retrans_timeout(struct work_struct *work) 1323static void l2cap_retrans_timeout(struct work_struct *work)
@@ -1335,6 +1337,7 @@ static void l2cap_retrans_timeout(struct work_struct *work)
1335 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); 1337 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL);
1336 1338
1337 l2cap_chan_unlock(chan); 1339 l2cap_chan_unlock(chan);
1340 l2cap_chan_put(chan);
1338} 1341}
1339 1342
1340static void l2cap_drop_acked_frames(struct l2cap_chan *chan) 1343static void l2cap_drop_acked_frames(struct l2cap_chan *chan)
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index c4fe583b0af..29122ed28ea 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
82 } 82 }
83 83
84 if (la.l2_cid) 84 if (la.l2_cid)
85 err = l2cap_add_scid(chan, la.l2_cid); 85 err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid));
86 else 86 else
87 err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm); 87 err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm);
88 88
@@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
123 if (la.l2_cid && la.l2_psm) 123 if (la.l2_cid && la.l2_psm)
124 return -EINVAL; 124 return -EINVAL;
125 125
126 err = l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_bdaddr); 126 err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
127 &la.l2_bdaddr);
127 if (err) 128 if (err)
128 return err; 129 return err;
129 130
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7fcff888713..4ef275c6967 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2523,13 +2523,18 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
2523 2523
2524 if (cp->val) { 2524 if (cp->val) {
2525 type = PAGE_SCAN_TYPE_INTERLACED; 2525 type = PAGE_SCAN_TYPE_INTERLACED;
2526 acp.interval = 0x0024; /* 22.5 msec page scan interval */ 2526
2527 /* 22.5 msec page scan interval */
2528 acp.interval = __constant_cpu_to_le16(0x0024);
2527 } else { 2529 } else {
2528 type = PAGE_SCAN_TYPE_STANDARD; /* default */ 2530 type = PAGE_SCAN_TYPE_STANDARD; /* default */
2529 acp.interval = 0x0800; /* default 1.28 sec page scan */ 2531
2532 /* default 1.28 sec page scan */
2533 acp.interval = __constant_cpu_to_le16(0x0800);
2530 } 2534 }
2531 2535
2532 acp.window = 0x0012; /* default 11.25 msec page scan window */ 2536 /* default 11.25 msec page scan window */
2537 acp.window = __constant_cpu_to_le16(0x0012);
2533 2538
2534 err = hci_send_cmd(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp), 2539 err = hci_send_cmd(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp),
2535 &acp); 2540 &acp);
@@ -2936,7 +2941,7 @@ int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
2936 name, name_len); 2941 name, name_len);
2937 2942
2938 if (dev_class && memcmp(dev_class, "\0\0\0", 3) != 0) 2943 if (dev_class && memcmp(dev_class, "\0\0\0", 3) != 0)
2939 eir_len = eir_append_data(&ev->eir[eir_len], eir_len, 2944 eir_len = eir_append_data(ev->eir, eir_len,
2940 EIR_CLASS_OF_DEV, dev_class, 3); 2945 EIR_CLASS_OF_DEV, dev_class, 3);
2941 2946
2942 put_unaligned_le16(eir_len, &ev->eir_len); 2947 put_unaligned_le16(eir_len, &ev->eir_len);
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 702a1ae9220..27ca25ed702 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -241,7 +241,6 @@ static void br_multicast_group_expired(unsigned long data)
241 hlist_del_rcu(&mp->hlist[mdb->ver]); 241 hlist_del_rcu(&mp->hlist[mdb->ver]);
242 mdb->size--; 242 mdb->size--;
243 243
244 del_timer(&mp->query_timer);
245 call_rcu_bh(&mp->rcu, br_multicast_free_group); 244 call_rcu_bh(&mp->rcu, br_multicast_free_group);
246 245
247out: 246out:
@@ -271,7 +270,6 @@ static void br_multicast_del_pg(struct net_bridge *br,
271 rcu_assign_pointer(*pp, p->next); 270 rcu_assign_pointer(*pp, p->next);
272 hlist_del_init(&p->mglist); 271 hlist_del_init(&p->mglist);
273 del_timer(&p->timer); 272 del_timer(&p->timer);
274 del_timer(&p->query_timer);
275 call_rcu_bh(&p->rcu, br_multicast_free_pg); 273 call_rcu_bh(&p->rcu, br_multicast_free_pg);
276 274
277 if (!mp->ports && !mp->mglist && 275 if (!mp->ports && !mp->mglist &&
@@ -507,74 +505,6 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br,
507 return NULL; 505 return NULL;
508} 506}
509 507
510static void br_multicast_send_group_query(struct net_bridge_mdb_entry *mp)
511{
512 struct net_bridge *br = mp->br;
513 struct sk_buff *skb;
514
515 skb = br_multicast_alloc_query(br, &mp->addr);
516 if (!skb)
517 goto timer;
518
519 netif_rx(skb);
520
521timer:
522 if (++mp->queries_sent < br->multicast_last_member_count)
523 mod_timer(&mp->query_timer,
524 jiffies + br->multicast_last_member_interval);
525}
526
527static void br_multicast_group_query_expired(unsigned long data)
528{
529 struct net_bridge_mdb_entry *mp = (void *)data;
530 struct net_bridge *br = mp->br;
531
532 spin_lock(&br->multicast_lock);
533 if (!netif_running(br->dev) || !mp->mglist ||
534 mp->queries_sent >= br->multicast_last_member_count)
535 goto out;
536
537 br_multicast_send_group_query(mp);
538
539out:
540 spin_unlock(&br->multicast_lock);
541}
542
543static void br_multicast_send_port_group_query(struct net_bridge_port_group *pg)
544{
545 struct net_bridge_port *port = pg->port;
546 struct net_bridge *br = port->br;
547 struct sk_buff *skb;
548
549 skb = br_multicast_alloc_query(br, &pg->addr);
550 if (!skb)
551 goto timer;
552
553 br_deliver(port, skb);
554
555timer:
556 if (++pg->queries_sent < br->multicast_last_member_count)
557 mod_timer(&pg->query_timer,
558 jiffies + br->multicast_last_member_interval);
559}
560
561static void br_multicast_port_group_query_expired(unsigned long data)
562{
563 struct net_bridge_port_group *pg = (void *)data;
564 struct net_bridge_port *port = pg->port;
565 struct net_bridge *br = port->br;
566
567 spin_lock(&br->multicast_lock);
568 if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) ||
569 pg->queries_sent >= br->multicast_last_member_count)
570 goto out;
571
572 br_multicast_send_port_group_query(pg);
573
574out:
575 spin_unlock(&br->multicast_lock);
576}
577
578static struct net_bridge_mdb_entry *br_multicast_get_group( 508static struct net_bridge_mdb_entry *br_multicast_get_group(
579 struct net_bridge *br, struct net_bridge_port *port, 509 struct net_bridge *br, struct net_bridge_port *port,
580 struct br_ip *group, int hash) 510 struct br_ip *group, int hash)
@@ -690,8 +620,6 @@ rehash:
690 mp->addr = *group; 620 mp->addr = *group;
691 setup_timer(&mp->timer, br_multicast_group_expired, 621 setup_timer(&mp->timer, br_multicast_group_expired,
692 (unsigned long)mp); 622 (unsigned long)mp);
693 setup_timer(&mp->query_timer, br_multicast_group_query_expired,
694 (unsigned long)mp);
695 623
696 hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); 624 hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]);
697 mdb->size++; 625 mdb->size++;
@@ -746,8 +674,6 @@ static int br_multicast_add_group(struct net_bridge *br,
746 hlist_add_head(&p->mglist, &port->mglist); 674 hlist_add_head(&p->mglist, &port->mglist);
747 setup_timer(&p->timer, br_multicast_port_group_expired, 675 setup_timer(&p->timer, br_multicast_port_group_expired,
748 (unsigned long)p); 676 (unsigned long)p);
749 setup_timer(&p->query_timer, br_multicast_port_group_query_expired,
750 (unsigned long)p);
751 677
752 rcu_assign_pointer(*pp, p); 678 rcu_assign_pointer(*pp, p);
753 679
@@ -1291,9 +1217,6 @@ static void br_multicast_leave_group(struct net_bridge *br,
1291 time_after(mp->timer.expires, time) : 1217 time_after(mp->timer.expires, time) :
1292 try_to_del_timer_sync(&mp->timer) >= 0)) { 1218 try_to_del_timer_sync(&mp->timer) >= 0)) {
1293 mod_timer(&mp->timer, time); 1219 mod_timer(&mp->timer, time);
1294
1295 mp->queries_sent = 0;
1296 mod_timer(&mp->query_timer, now);
1297 } 1220 }
1298 1221
1299 goto out; 1222 goto out;
@@ -1310,9 +1233,6 @@ static void br_multicast_leave_group(struct net_bridge *br,
1310 time_after(p->timer.expires, time) : 1233 time_after(p->timer.expires, time) :
1311 try_to_del_timer_sync(&p->timer) >= 0)) { 1234 try_to_del_timer_sync(&p->timer) >= 0)) {
1312 mod_timer(&p->timer, time); 1235 mod_timer(&p->timer, time);
1313
1314 p->queries_sent = 0;
1315 mod_timer(&p->query_timer, now);
1316 } 1236 }
1317 1237
1318 break; 1238 break;
@@ -1681,7 +1601,6 @@ void br_multicast_stop(struct net_bridge *br)
1681 hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], 1601 hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i],
1682 hlist[ver]) { 1602 hlist[ver]) {
1683 del_timer(&mp->timer); 1603 del_timer(&mp->timer);
1684 del_timer(&mp->query_timer);
1685 call_rcu_bh(&mp->rcu, br_multicast_free_group); 1604 call_rcu_bh(&mp->rcu, br_multicast_free_group);
1686 } 1605 }
1687 } 1606 }
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 0b67a63ad7a..e1d88225787 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -82,9 +82,7 @@ struct net_bridge_port_group {
82 struct hlist_node mglist; 82 struct hlist_node mglist;
83 struct rcu_head rcu; 83 struct rcu_head rcu;
84 struct timer_list timer; 84 struct timer_list timer;
85 struct timer_list query_timer;
86 struct br_ip addr; 85 struct br_ip addr;
87 u32 queries_sent;
88}; 86};
89 87
90struct net_bridge_mdb_entry 88struct net_bridge_mdb_entry
@@ -94,10 +92,8 @@ struct net_bridge_mdb_entry
94 struct net_bridge_port_group __rcu *ports; 92 struct net_bridge_port_group __rcu *ports;
95 struct rcu_head rcu; 93 struct rcu_head rcu;
96 struct timer_list timer; 94 struct timer_list timer;
97 struct timer_list query_timer;
98 struct br_ip addr; 95 struct br_ip addr;
99 bool mglist; 96 bool mglist;
100 u32 queries_sent;
101}; 97};
102 98
103struct net_bridge_mdb_htable 99struct net_bridge_mdb_htable
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 20618dd3088..d09340e1523 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
103 skb->protocol = htons(ETH_P_IPV6); 103 skb->protocol = htons(ETH_P_IPV6);
104 break; 104 break;
105 default: 105 default:
106 kfree_skb(skb);
106 priv->netdev->stats.rx_errors++; 107 priv->netdev->stats.rx_errors++;
107 return -EINVAL; 108 return -EINVAL;
108 } 109 }
@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
220 221
221 if (skb->len > priv->netdev->mtu) { 222 if (skb->len > priv->netdev->mtu) {
222 pr_warn("Size of skb exceeded MTU\n"); 223 pr_warn("Size of skb exceeded MTU\n");
224 kfree_skb(skb);
223 dev->stats.tx_errors++; 225 dev->stats.tx_errors++;
224 return -ENOSPC; 226 return NETDEV_TX_OK;
225 } 227 }
226 228
227 if (!priv->flowenabled) { 229 if (!priv->flowenabled) {
228 pr_debug("dropping packets flow off\n"); 230 pr_debug("dropping packets flow off\n");
231 kfree_skb(skb);
229 dev->stats.tx_dropped++; 232 dev->stats.tx_dropped++;
230 return NETDEV_TX_BUSY; 233 return NETDEV_TX_OK;
231 } 234 }
232 235
233 if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) 236 if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP)
@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
242 result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); 245 result = priv->chnl.dn->transmit(priv->chnl.dn, pkt);
243 if (result) { 246 if (result) {
244 dev->stats.tx_dropped++; 247 dev->stats.tx_dropped++;
245 return result; 248 return NETDEV_TX_OK;
246 } 249 }
247 250
248 /* Update statistics. */ 251 /* Update statistics. */
diff --git a/net/core/dev.c b/net/core/dev.c
index c25d453b280..9bb8f87c4cd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier);
1409 * register_netdevice_notifier(). The notifier is unlinked into the 1409 * register_netdevice_notifier(). The notifier is unlinked into the
1410 * kernel structures and may then be reused. A negative errno code 1410 * kernel structures and may then be reused. A negative errno code
1411 * is returned on a failure. 1411 * is returned on a failure.
1412 *
1413 * After unregistering unregister and down device events are synthesized
1414 * for all devices on the device list to the removed notifier to remove
1415 * the need for special case cleanup code.
1412 */ 1416 */
1413 1417
1414int unregister_netdevice_notifier(struct notifier_block *nb) 1418int unregister_netdevice_notifier(struct notifier_block *nb)
1415{ 1419{
1420 struct net_device *dev;
1421 struct net *net;
1416 int err; 1422 int err;
1417 1423
1418 rtnl_lock(); 1424 rtnl_lock();
1419 err = raw_notifier_chain_unregister(&netdev_chain, nb); 1425 err = raw_notifier_chain_unregister(&netdev_chain, nb);
1426 if (err)
1427 goto unlock;
1428
1429 for_each_net(net) {
1430 for_each_netdev(net, dev) {
1431 if (dev->flags & IFF_UP) {
1432 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
1433 nb->notifier_call(nb, NETDEV_DOWN, dev);
1434 }
1435 nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
1436 nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev);
1437 }
1438 }
1439unlock:
1420 rtnl_unlock(); 1440 rtnl_unlock();
1421 return err; 1441 return err;
1422} 1442}
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 7f36b38e060..5c3c81a609e 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -150,6 +150,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location)
150 for (i = 0; i < msg->entries; i++) { 150 for (i = 0; i < msg->entries; i++) {
151 if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { 151 if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) {
152 msg->points[i].count++; 152 msg->points[i].count++;
153 atomic_inc(&data->dm_hit_count);
153 goto out; 154 goto out;
154 } 155 }
155 } 156 }
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 0e950fda9a0..31a5ae51a45 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -83,21 +83,29 @@ assign:
83 83
84static int ops_init(const struct pernet_operations *ops, struct net *net) 84static int ops_init(const struct pernet_operations *ops, struct net *net)
85{ 85{
86 int err; 86 int err = -ENOMEM;
87 void *data = NULL;
88
87 if (ops->id && ops->size) { 89 if (ops->id && ops->size) {
88 void *data = kzalloc(ops->size, GFP_KERNEL); 90 data = kzalloc(ops->size, GFP_KERNEL);
89 if (!data) 91 if (!data)
90 return -ENOMEM; 92 goto out;
91 93
92 err = net_assign_generic(net, *ops->id, data); 94 err = net_assign_generic(net, *ops->id, data);
93 if (err) { 95 if (err)
94 kfree(data); 96 goto cleanup;
95 return err;
96 }
97 } 97 }
98 err = 0;
98 if (ops->init) 99 if (ops->init)
99 return ops->init(net); 100 err = ops->init(net);
100 return 0; 101 if (!err)
102 return 0;
103
104cleanup:
105 kfree(data);
106
107out:
108 return err;
101} 109}
102 110
103static void ops_free(const struct pernet_operations *ops, struct net *net) 111static void ops_free(const struct pernet_operations *ops, struct net *net)
@@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops)
448static int __register_pernet_operations(struct list_head *list, 456static int __register_pernet_operations(struct list_head *list,
449 struct pernet_operations *ops) 457 struct pernet_operations *ops)
450{ 458{
451 int err = 0; 459 return ops_init(ops, &init_net);
452 err = ops_init(ops, &init_net);
453 if (err)
454 ops_free(ops, &init_net);
455 return err;
456
457} 460}
458 461
459static void __unregister_pernet_operations(struct pernet_operations *ops) 462static void __unregister_pernet_operations(struct pernet_operations *ops)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index baf8d281152..e59840010d4 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -952,9 +952,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
952 goto adjust_others; 952 goto adjust_others;
953 } 953 }
954 954
955 data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); 955 data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
956 gfp_mask);
956 if (!data) 957 if (!data)
957 goto nodata; 958 goto nodata;
959 size = SKB_WITH_OVERHEAD(ksize(data));
958 960
959 /* Copy only real data... and, alas, header. This should be 961 /* Copy only real data... and, alas, header. This should be
960 * optimized for the cases when header is void. 962 * optimized for the cases when header is void.
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index de9da21113a..cf73cc70ed2 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -74,16 +74,24 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
74 74
75 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); 75 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
76 if (iph == NULL) 76 if (iph == NULL)
77 return -NF_DROP; 77 return -NF_ACCEPT;
78 78
79 /* Conntrack defragments packets, we might still see fragments 79 /* Conntrack defragments packets, we might still see fragments
80 * inside ICMP packets though. */ 80 * inside ICMP packets though. */
81 if (iph->frag_off & htons(IP_OFFSET)) 81 if (iph->frag_off & htons(IP_OFFSET))
82 return -NF_DROP; 82 return -NF_ACCEPT;
83 83
84 *dataoff = nhoff + (iph->ihl << 2); 84 *dataoff = nhoff + (iph->ihl << 2);
85 *protonum = iph->protocol; 85 *protonum = iph->protocol;
86 86
87 /* Check bogus IP headers */
88 if (*dataoff > skb->len) {
89 pr_debug("nf_conntrack_ipv4: bogus IPv4 packet: "
90 "nhoff %u, ihl %u, skblen %u\n",
91 nhoff, iph->ihl << 2, skb->len);
92 return -NF_ACCEPT;
93 }
94
87 return NF_ACCEPT; 95 return NF_ACCEPT;
88} 96}
89 97
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 5d54ed30e82..8bb6adeb62c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp)
701 skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); 701 skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
702 if (skb) { 702 if (skb) {
703 if (sk_wmem_schedule(sk, skb->truesize)) { 703 if (sk_wmem_schedule(sk, skb->truesize)) {
704 skb_reserve(skb, sk->sk_prot->max_header);
704 /* 705 /*
705 * Make sure that we have exactly size bytes 706 * Make sure that we have exactly size bytes
706 * available to the caller, no more, no less. 707 * available to the caller, no more, no less.
707 */ 708 */
708 skb_reserve(skb, skb_tailroom(skb) - size); 709 skb->avail_size = size;
709 return skb; 710 return skb;
710 } 711 }
711 __kfree_skb(skb); 712 __kfree_skb(skb);
@@ -995,10 +996,9 @@ new_segment:
995 copy = seglen; 996 copy = seglen;
996 997
997 /* Where to copy to? */ 998 /* Where to copy to? */
998 if (skb_tailroom(skb) > 0) { 999 if (skb_availroom(skb) > 0) {
999 /* We have some space in skb head. Superb! */ 1000 /* We have some space in skb head. Superb! */
1000 if (copy > skb_tailroom(skb)) 1001 copy = min_t(int, copy, skb_availroom(skb));
1001 copy = skb_tailroom(skb);
1002 err = skb_add_data_nocache(sk, skb, from, copy); 1002 err = skb_add_data_nocache(sk, skb, from, copy);
1003 if (err) 1003 if (err)
1004 goto do_fault; 1004 goto do_fault;
@@ -1452,7 +1452,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1452 if ((available < target) && 1452 if ((available < target) &&
1453 (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && 1453 (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
1454 !sysctl_tcp_low_latency && 1454 !sysctl_tcp_low_latency &&
1455 dma_find_channel(DMA_MEMCPY)) { 1455 net_dma_find_channel()) {
1456 preempt_enable_no_resched(); 1456 preempt_enable_no_resched();
1457 tp->ucopy.pinned_list = 1457 tp->ucopy.pinned_list =
1458 dma_pin_iovec_pages(msg->msg_iov, len); 1458 dma_pin_iovec_pages(msg->msg_iov, len);
@@ -1667,7 +1667,7 @@ do_prequeue:
1667 if (!(flags & MSG_TRUNC)) { 1667 if (!(flags & MSG_TRUNC)) {
1668#ifdef CONFIG_NET_DMA 1668#ifdef CONFIG_NET_DMA
1669 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) 1669 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1670 tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); 1670 tp->ucopy.dma_chan = net_dma_find_channel();
1671 1671
1672 if (tp->ucopy.dma_chan) { 1672 if (tp->ucopy.dma_chan) {
1673 tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( 1673 tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec(
@@ -3302,8 +3302,7 @@ void __init tcp_init(void)
3302 3302
3303 tcp_init_mem(&init_net); 3303 tcp_init_mem(&init_net);
3304 /* Set per-socket limits to no more than 1/128 the pressure threshold */ 3304 /* Set per-socket limits to no more than 1/128 the pressure threshold */
3305 limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10); 3305 limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7);
3306 limit = max(limit, 128UL);
3307 max_share = min(4UL*1024*1024, limit); 3306 max_share = min(4UL*1024*1024, limit);
3308 3307
3309 sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; 3308 sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e886e2f7fa8..3ff36406537 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -335,6 +335,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)
335 incr = __tcp_grow_window(sk, skb); 335 incr = __tcp_grow_window(sk, skb);
336 336
337 if (incr) { 337 if (incr) {
338 incr = max_t(int, incr, 2 * skb->len);
338 tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, 339 tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr,
339 tp->window_clamp); 340 tp->window_clamp);
340 inet_csk(sk)->icsk_ack.quick |= 1; 341 inet_csk(sk)->icsk_ack.quick |= 1;
@@ -474,8 +475,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)
474 if (!win_dep) { 475 if (!win_dep) {
475 m -= (new_sample >> 3); 476 m -= (new_sample >> 3);
476 new_sample += m; 477 new_sample += m;
477 } else if (m < new_sample) 478 } else {
478 new_sample = m << 3; 479 m <<= 3;
480 if (m < new_sample)
481 new_sample = m;
482 }
479 } else { 483 } else {
480 /* No previous measure. */ 484 /* No previous measure. */
481 new_sample = m << 3; 485 new_sample = m << 3;
@@ -5225,7 +5229,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb,
5225 return 0; 5229 return 0;
5226 5230
5227 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) 5231 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
5228 tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); 5232 tp->ucopy.dma_chan = net_dma_find_channel();
5229 5233
5230 if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { 5234 if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) {
5231 5235
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3a25cf743f8..0cb86ceb652 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1730,7 +1730,7 @@ process:
1730#ifdef CONFIG_NET_DMA 1730#ifdef CONFIG_NET_DMA
1731 struct tcp_sock *tp = tcp_sk(sk); 1731 struct tcp_sock *tp = tcp_sk(sk);
1732 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) 1732 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1733 tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); 1733 tp->ucopy.dma_chan = net_dma_find_channel();
1734 if (tp->ucopy.dma_chan) 1734 if (tp->ucopy.dma_chan)
1735 ret = tcp_v4_do_rcv(sk, skb); 1735 ret = tcp_v4_do_rcv(sk, skb);
1736 else 1736 else
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 364784a9193..7ac6423117a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1096,6 +1096,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
1096 eat = min_t(int, len, skb_headlen(skb)); 1096 eat = min_t(int, len, skb_headlen(skb));
1097 if (eat) { 1097 if (eat) {
1098 __skb_pull(skb, eat); 1098 __skb_pull(skb, eat);
1099 skb->avail_size -= eat;
1099 len -= eat; 1100 len -= eat;
1100 if (!len) 1101 if (!len)
1101 return; 1102 return;
@@ -2060,7 +2061,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to,
2060 /* Punt if not enough space exists in the first SKB for 2061 /* Punt if not enough space exists in the first SKB for
2061 * the data in the second 2062 * the data in the second
2062 */ 2063 */
2063 if (skb->len > skb_tailroom(to)) 2064 if (skb->len > skb_availroom(to))
2064 break; 2065 break;
2065 2066
2066 if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) 2067 if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp)))
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6a3bb6077e1..7d5cb975cc6 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -803,8 +803,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
803 ip6_del_rt(rt); 803 ip6_del_rt(rt);
804 rt = NULL; 804 rt = NULL;
805 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { 805 } else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
806 rt->dst.expires = expires; 806 rt6_set_expires(rt, expires);
807 rt->rt6i_flags |= RTF_EXPIRES;
808 } 807 }
809 } 808 }
810 dst_release(&rt->dst); 809 dst_release(&rt->dst);
@@ -1887,11 +1886,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
1887 rt = NULL; 1886 rt = NULL;
1888 } else if (addrconf_finite_timeout(rt_expires)) { 1887 } else if (addrconf_finite_timeout(rt_expires)) {
1889 /* not infinity */ 1888 /* not infinity */
1890 rt->dst.expires = jiffies + rt_expires; 1889 rt6_set_expires(rt, jiffies + rt_expires);
1891 rt->rt6i_flags |= RTF_EXPIRES;
1892 } else { 1890 } else {
1893 rt->rt6i_flags &= ~RTF_EXPIRES; 1891 rt6_clean_expires(rt);
1894 rt->dst.expires = 0;
1895 } 1892 }
1896 } else if (valid_lft) { 1893 } else if (valid_lft) {
1897 clock_t expires = 0; 1894 clock_t expires = 0;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 5b27fbcae34..93717435013 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -673,11 +673,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
673 &rt->rt6i_gateway)) { 673 &rt->rt6i_gateway)) {
674 if (!(iter->rt6i_flags & RTF_EXPIRES)) 674 if (!(iter->rt6i_flags & RTF_EXPIRES))
675 return -EEXIST; 675 return -EEXIST;
676 iter->dst.expires = rt->dst.expires; 676 if (!(rt->rt6i_flags & RTF_EXPIRES))
677 if (!(rt->rt6i_flags & RTF_EXPIRES)) { 677 rt6_clean_expires(iter);
678 iter->rt6i_flags &= ~RTF_EXPIRES; 678 else
679 iter->dst.expires = 0; 679 rt6_set_expires(iter, rt->dst.expires);
680 }
681 return -EEXIST; 680 return -EEXIST;
682 } 681 }
683 } 682 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 3dcdb81ec3e..176b469322a 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1264,8 +1264,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1264 } 1264 }
1265 1265
1266 if (rt) 1266 if (rt)
1267 rt->dst.expires = jiffies + (HZ * lifetime); 1267 rt6_set_expires(rt, jiffies + (HZ * lifetime));
1268
1269 if (ra_msg->icmph.icmp6_hop_limit) { 1268 if (ra_msg->icmph.icmp6_hop_limit) {
1270 in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; 1269 in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
1271 if (rt) 1270 if (rt)
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 94874b0bdcd..9d4e1555931 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -78,19 +78,6 @@ EXPORT_SYMBOL_GPL(ip6t_alloc_initial_table);
78 78
79 Hence the start of any table is given by get_table() below. */ 79 Hence the start of any table is given by get_table() below. */
80 80
81/* Check for an extension */
82int
83ip6t_ext_hdr(u8 nexthdr)
84{
85 return (nexthdr == IPPROTO_HOPOPTS) ||
86 (nexthdr == IPPROTO_ROUTING) ||
87 (nexthdr == IPPROTO_FRAGMENT) ||
88 (nexthdr == IPPROTO_ESP) ||
89 (nexthdr == IPPROTO_AH) ||
90 (nexthdr == IPPROTO_NONE) ||
91 (nexthdr == IPPROTO_DSTOPTS);
92}
93
94/* Returns whether matches rule or not. */ 81/* Returns whether matches rule or not. */
95/* Performance critical - called for every packet */ 82/* Performance critical - called for every packet */
96static inline bool 83static inline bool
@@ -2366,7 +2353,6 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
2366EXPORT_SYMBOL(ip6t_register_table); 2353EXPORT_SYMBOL(ip6t_register_table);
2367EXPORT_SYMBOL(ip6t_unregister_table); 2354EXPORT_SYMBOL(ip6t_unregister_table);
2368EXPORT_SYMBOL(ip6t_do_table); 2355EXPORT_SYMBOL(ip6t_do_table);
2369EXPORT_SYMBOL(ip6t_ext_hdr);
2370EXPORT_SYMBOL(ipv6_find_hdr); 2356EXPORT_SYMBOL(ipv6_find_hdr);
2371 2357
2372module_init(ip6_tables_init); 2358module_init(ip6_tables_init);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 3992e26a603..bc4888d902b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -62,7 +62,7 @@
62#include <linux/sysctl.h> 62#include <linux/sysctl.h>
63#endif 63#endif
64 64
65static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, 65static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,
66 const struct in6_addr *dest); 66 const struct in6_addr *dest);
67static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); 67static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie);
68static unsigned int ip6_default_advmss(const struct dst_entry *dst); 68static unsigned int ip6_default_advmss(const struct dst_entry *dst);
@@ -285,6 +285,10 @@ static void ip6_dst_destroy(struct dst_entry *dst)
285 rt->rt6i_idev = NULL; 285 rt->rt6i_idev = NULL;
286 in6_dev_put(idev); 286 in6_dev_put(idev);
287 } 287 }
288
289 if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from)
290 dst_release(dst->from);
291
288 if (peer) { 292 if (peer) {
289 rt->rt6i_peer = NULL; 293 rt->rt6i_peer = NULL;
290 inet_putpeer(peer); 294 inet_putpeer(peer);
@@ -329,8 +333,17 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
329 333
330static __inline__ int rt6_check_expired(const struct rt6_info *rt) 334static __inline__ int rt6_check_expired(const struct rt6_info *rt)
331{ 335{
332 return (rt->rt6i_flags & RTF_EXPIRES) && 336 struct rt6_info *ort = NULL;
333 time_after(jiffies, rt->dst.expires); 337
338 if (rt->rt6i_flags & RTF_EXPIRES) {
339 if (time_after(jiffies, rt->dst.expires))
340 return 1;
341 } else if (rt->dst.from) {
342 ort = (struct rt6_info *) rt->dst.from;
343 return (ort->rt6i_flags & RTF_EXPIRES) &&
344 time_after(jiffies, ort->dst.expires);
345 }
346 return 0;
334} 347}
335 348
336static inline int rt6_need_strict(const struct in6_addr *daddr) 349static inline int rt6_need_strict(const struct in6_addr *daddr)
@@ -620,12 +633,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
620 (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); 633 (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref);
621 634
622 if (rt) { 635 if (rt) {
623 if (!addrconf_finite_timeout(lifetime)) { 636 if (!addrconf_finite_timeout(lifetime))
624 rt->rt6i_flags &= ~RTF_EXPIRES; 637 rt6_clean_expires(rt);
625 } else { 638 else
626 rt->dst.expires = jiffies + HZ * lifetime; 639 rt6_set_expires(rt, jiffies + HZ * lifetime);
627 rt->rt6i_flags |= RTF_EXPIRES; 640
628 }
629 dst_release(&rt->dst); 641 dst_release(&rt->dst);
630 } 642 }
631 return 0; 643 return 0;
@@ -730,7 +742,7 @@ int ip6_ins_rt(struct rt6_info *rt)
730 return __ip6_ins_rt(rt, &info); 742 return __ip6_ins_rt(rt, &info);
731} 743}
732 744
733static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, 745static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort,
734 const struct in6_addr *daddr, 746 const struct in6_addr *daddr,
735 const struct in6_addr *saddr) 747 const struct in6_addr *saddr)
736{ 748{
@@ -954,10 +966,10 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
954 rt->rt6i_idev = ort->rt6i_idev; 966 rt->rt6i_idev = ort->rt6i_idev;
955 if (rt->rt6i_idev) 967 if (rt->rt6i_idev)
956 in6_dev_hold(rt->rt6i_idev); 968 in6_dev_hold(rt->rt6i_idev);
957 rt->dst.expires = 0;
958 969
959 rt->rt6i_gateway = ort->rt6i_gateway; 970 rt->rt6i_gateway = ort->rt6i_gateway;
960 rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; 971 rt->rt6i_flags = ort->rt6i_flags;
972 rt6_clean_expires(rt);
961 rt->rt6i_metric = 0; 973 rt->rt6i_metric = 0;
962 974
963 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); 975 memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key));
@@ -1019,10 +1031,9 @@ static void ip6_link_failure(struct sk_buff *skb)
1019 1031
1020 rt = (struct rt6_info *) skb_dst(skb); 1032 rt = (struct rt6_info *) skb_dst(skb);
1021 if (rt) { 1033 if (rt) {
1022 if (rt->rt6i_flags & RTF_CACHE) { 1034 if (rt->rt6i_flags & RTF_CACHE)
1023 dst_set_expires(&rt->dst, 0); 1035 rt6_update_expires(rt, 0);
1024 rt->rt6i_flags |= RTF_EXPIRES; 1036 else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT))
1025 } else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT))
1026 rt->rt6i_node->fn_sernum = -1; 1037 rt->rt6i_node->fn_sernum = -1;
1027 } 1038 }
1028} 1039}
@@ -1289,9 +1300,12 @@ int ip6_route_add(struct fib6_config *cfg)
1289 } 1300 }
1290 1301
1291 rt->dst.obsolete = -1; 1302 rt->dst.obsolete = -1;
1292 rt->dst.expires = (cfg->fc_flags & RTF_EXPIRES) ? 1303
1293 jiffies + clock_t_to_jiffies(cfg->fc_expires) : 1304 if (cfg->fc_flags & RTF_EXPIRES)
1294 0; 1305 rt6_set_expires(rt, jiffies +
1306 clock_t_to_jiffies(cfg->fc_expires));
1307 else
1308 rt6_clean_expires(rt);
1295 1309
1296 if (cfg->fc_protocol == RTPROT_UNSPEC) 1310 if (cfg->fc_protocol == RTPROT_UNSPEC)
1297 cfg->fc_protocol = RTPROT_BOOT; 1311 cfg->fc_protocol = RTPROT_BOOT;
@@ -1736,8 +1750,8 @@ again:
1736 features |= RTAX_FEATURE_ALLFRAG; 1750 features |= RTAX_FEATURE_ALLFRAG;
1737 dst_metric_set(&rt->dst, RTAX_FEATURES, features); 1751 dst_metric_set(&rt->dst, RTAX_FEATURES, features);
1738 } 1752 }
1739 dst_set_expires(&rt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); 1753 rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires);
1740 rt->rt6i_flags |= RTF_MODIFIED|RTF_EXPIRES; 1754 rt->rt6i_flags |= RTF_MODIFIED;
1741 goto out; 1755 goto out;
1742 } 1756 }
1743 1757
@@ -1765,9 +1779,8 @@ again:
1765 * which is 10 mins. After 10 mins the decreased pmtu is expired 1779 * which is 10 mins. After 10 mins the decreased pmtu is expired
1766 * and detecting PMTU increase will be automatically happened. 1780 * and detecting PMTU increase will be automatically happened.
1767 */ 1781 */
1768 dst_set_expires(&nrt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); 1782 rt6_update_expires(nrt, net->ipv6.sysctl.ip6_rt_mtu_expires);
1769 nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES; 1783 nrt->rt6i_flags |= RTF_DYNAMIC;
1770
1771 ip6_ins_rt(nrt); 1784 ip6_ins_rt(nrt);
1772 } 1785 }
1773out: 1786out:
@@ -1799,7 +1812,7 @@ void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *sad
1799 * Misc support functions 1812 * Misc support functions
1800 */ 1813 */
1801 1814
1802static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, 1815static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,
1803 const struct in6_addr *dest) 1816 const struct in6_addr *dest)
1804{ 1817{
1805 struct net *net = dev_net(ort->dst.dev); 1818 struct net *net = dev_net(ort->dst.dev);
@@ -1819,10 +1832,14 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort,
1819 if (rt->rt6i_idev) 1832 if (rt->rt6i_idev)
1820 in6_dev_hold(rt->rt6i_idev); 1833 in6_dev_hold(rt->rt6i_idev);
1821 rt->dst.lastuse = jiffies; 1834 rt->dst.lastuse = jiffies;
1822 rt->dst.expires = 0;
1823 1835
1824 rt->rt6i_gateway = ort->rt6i_gateway; 1836 rt->rt6i_gateway = ort->rt6i_gateway;
1825 rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; 1837 rt->rt6i_flags = ort->rt6i_flags;
1838 if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ==
1839 (RTF_DEFAULT | RTF_ADDRCONF))
1840 rt6_set_from(rt, ort);
1841 else
1842 rt6_clean_expires(rt);
1826 rt->rt6i_metric = 0; 1843 rt->rt6i_metric = 0;
1827 1844
1828#ifdef CONFIG_IPV6_SUBTREES 1845#ifdef CONFIG_IPV6_SUBTREES
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 12c6ece67f3..98256cf72f9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1383,6 +1383,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1383 tcp_mtup_init(newsk); 1383 tcp_mtup_init(newsk);
1384 tcp_sync_mss(newsk, dst_mtu(dst)); 1384 tcp_sync_mss(newsk, dst_mtu(dst));
1385 newtp->advmss = dst_metric_advmss(dst); 1385 newtp->advmss = dst_metric_advmss(dst);
1386 if (tcp_sk(sk)->rx_opt.user_mss &&
1387 tcp_sk(sk)->rx_opt.user_mss < newtp->advmss)
1388 newtp->advmss = tcp_sk(sk)->rx_opt.user_mss;
1389
1386 tcp_initialize_rcv_mss(newsk); 1390 tcp_initialize_rcv_mss(newsk);
1387 if (tcp_rsk(req)->snt_synack) 1391 if (tcp_rsk(req)->snt_synack)
1388 tcp_valid_rtt_meas(newsk, 1392 tcp_valid_rtt_meas(newsk,
@@ -1645,7 +1649,7 @@ process:
1645#ifdef CONFIG_NET_DMA 1649#ifdef CONFIG_NET_DMA
1646 struct tcp_sock *tp = tcp_sk(sk); 1650 struct tcp_sock *tp = tcp_sk(sk);
1647 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) 1651 if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
1648 tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); 1652 tp->ucopy.dma_chan = net_dma_find_channel();
1649 if (tp->ucopy.dma_chan) 1653 if (tp->ucopy.dma_chan)
1650 ret = tcp_v6_do_rcv(sk, skb); 1654 ret = tcp_v6_do_rcv(sk, skb);
1651 else 1655 else
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 11dbb2255cc..7e5d927b576 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3480,7 +3480,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
3480 3480
3481 /* Addresses to be used by KM for negotiation, if ext is available */ 3481 /* Addresses to be used by KM for negotiation, if ext is available */
3482 if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) 3482 if (k != NULL && (set_sadb_kmaddress(skb, k) < 0))
3483 return -EINVAL; 3483 goto err;
3484 3484
3485 /* selector src */ 3485 /* selector src */
3486 set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); 3486 set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel);
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 55670ec3cd0..585d93ecee2 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout)
232{ 232{
233 write_lock_bh(&l2tp_ip_lock); 233 write_lock_bh(&l2tp_ip_lock);
234 hlist_del_init(&sk->sk_bind_node); 234 hlist_del_init(&sk->sk_bind_node);
235 hlist_del_init(&sk->sk_node); 235 sk_del_node_init(sk);
236 write_unlock_bh(&l2tp_ip_lock); 236 write_unlock_bh(&l2tp_ip_lock);
237 sk_common_release(sk); 237 sk_common_release(sk);
238} 238}
@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
271 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) 271 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
272 goto out; 272 goto out;
273 273
274 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; 274 if (addr->l2tp_addr.s_addr)
275 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
275 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) 276 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
276 inet->inet_saddr = 0; /* Use device */ 277 inet->inet_saddr = 0; /* Use device */
277 sk_dst_reset(sk); 278 sk_dst_reset(sk);
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 33fd8d9f714..cef7c29214a 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -457,8 +457,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
457 * fall back to HT20 if we don't use or use 457 * fall back to HT20 if we don't use or use
458 * the other extension channel 458 * the other extension channel
459 */ 459 */
460 if ((channel_type == NL80211_CHAN_HT40MINUS || 460 if (!(channel_type == NL80211_CHAN_HT40MINUS ||
461 channel_type == NL80211_CHAN_HT40PLUS) && 461 channel_type == NL80211_CHAN_HT40PLUS) ||
462 channel_type != sdata->u.ibss.channel_type) 462 channel_type != sdata->u.ibss.channel_type)
463 sta_ht_cap_new.cap &= 463 sta_ht_cap_new.cap &=
464 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; 464 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 576fb25456d..f76da5b3f5c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3387,8 +3387,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3387 */ 3387 */
3388 printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", 3388 printk(KERN_DEBUG "%s: waiting for beacon from %pM\n",
3389 sdata->name, ifmgd->bssid); 3389 sdata->name, ifmgd->bssid);
3390 assoc_data->timeout = jiffies + 3390 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval);
3391 TU_TO_EXP_TIME(req->bss->beacon_interval);
3392 } else { 3391 } else {
3393 assoc_data->have_beacon = true; 3392 assoc_data->have_beacon = true;
3394 assoc_data->sent_assoc = false; 3393 assoc_data->sent_assoc = false;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bcfe8c77c83..d64e285400a 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -103,7 +103,7 @@ static void
103ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, 103ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
104 struct sk_buff *skb, 104 struct sk_buff *skb,
105 struct ieee80211_rate *rate, 105 struct ieee80211_rate *rate,
106 int rtap_len) 106 int rtap_len, bool has_fcs)
107{ 107{
108 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 108 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
109 struct ieee80211_radiotap_header *rthdr; 109 struct ieee80211_radiotap_header *rthdr;
@@ -134,7 +134,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
134 } 134 }
135 135
136 /* IEEE80211_RADIOTAP_FLAGS */ 136 /* IEEE80211_RADIOTAP_FLAGS */
137 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) 137 if (has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS))
138 *pos |= IEEE80211_RADIOTAP_F_FCS; 138 *pos |= IEEE80211_RADIOTAP_F_FCS;
139 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) 139 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
140 *pos |= IEEE80211_RADIOTAP_F_BADFCS; 140 *pos |= IEEE80211_RADIOTAP_F_BADFCS;
@@ -294,7 +294,8 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
294 } 294 }
295 295
296 /* prepend radiotap information */ 296 /* prepend radiotap information */
297 ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); 297 ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom,
298 true);
298 299
299 skb_reset_mac_header(skb); 300 skb_reset_mac_header(skb);
300 skb->ip_summed = CHECKSUM_UNNECESSARY; 301 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -2571,7 +2572,8 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
2571 goto out_free_skb; 2572 goto out_free_skb;
2572 2573
2573 /* prepend radiotap information */ 2574 /* prepend radiotap information */
2574 ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); 2575 ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom,
2576 false);
2575 2577
2576 skb_set_mac_header(skb, 0); 2578 skb_set_mac_header(skb, 0);
2577 skb->ip_summed = CHECKSUM_UNNECESSARY; 2579 skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 3cc4487ac34..729f157a0ef 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1592,7 +1592,7 @@ static int nf_conntrack_init_net(struct net *net)
1592 return 0; 1592 return 0;
1593 1593
1594err_timeout: 1594err_timeout:
1595 nf_conntrack_timeout_fini(net); 1595 nf_conntrack_ecache_fini(net);
1596err_ecache: 1596err_ecache:
1597 nf_conntrack_tstamp_fini(net); 1597 nf_conntrack_tstamp_fini(net);
1598err_tstamp: 1598err_tstamp:
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 361eade62a0..0d07a1dcf60 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
584 * Let's try to use the data from the packet. 584 * Let's try to use the data from the packet.
585 */ 585 */
586 sender->td_end = end; 586 sender->td_end = end;
587 win <<= sender->td_scale; 587 swin = win << sender->td_scale;
588 sender->td_maxwin = (win == 0 ? 1 : win); 588 sender->td_maxwin = (swin == 0 ? 1 : swin);
589 sender->td_maxend = end + sender->td_maxwin; 589 sender->td_maxend = end + sender->td_maxwin;
590 /* 590 /*
591 * We haven't seen traffic in the other direction yet 591 * We haven't seen traffic in the other direction yet
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c
index 7b76eb7192f..ef10ffcb4b6 100644
--- a/net/nfc/llcp/commands.c
+++ b/net/nfc/llcp/commands.c
@@ -474,7 +474,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
474 474
475 while (remaining_len > 0) { 475 while (remaining_len > 0) {
476 476
477 frag_len = min_t(u16, local->remote_miu, remaining_len); 477 frag_len = min_t(size_t, local->remote_miu, remaining_len);
478 478
479 pr_debug("Fragment %zd bytes remaining %zd", 479 pr_debug("Fragment %zd bytes remaining %zd",
480 frag_len, remaining_len); 480 frag_len, remaining_len);
@@ -497,7 +497,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
497 release_sock(sk); 497 release_sock(sk);
498 498
499 remaining_len -= frag_len; 499 remaining_len -= frag_len;
500 msg_ptr += len; 500 msg_ptr += frag_len;
501 } 501 }
502 502
503 kfree(msg_data); 503 kfree(msg_data);
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 9b9a85ecc4c..bf5cf69c820 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -331,23 +331,6 @@ static int __net_init phonet_init_net(struct net *net)
331 331
332static void __net_exit phonet_exit_net(struct net *net) 332static void __net_exit phonet_exit_net(struct net *net)
333{ 333{
334 struct phonet_net *pnn = phonet_pernet(net);
335 struct net_device *dev;
336 unsigned i;
337
338 rtnl_lock();
339 for_each_netdev(net, dev)
340 phonet_device_destroy(dev);
341
342 for (i = 0; i < 64; i++) {
343 dev = pnn->routes.table[i];
344 if (dev) {
345 rtm_phonet_notify(RTM_DELROUTE, dev, i);
346 dev_put(dev);
347 }
348 }
349 rtnl_unlock();
350
351 proc_net_remove(net, "phonet"); 334 proc_net_remove(net, "phonet");
352} 335}
353 336
@@ -361,7 +344,7 @@ static struct pernet_operations phonet_net_ops = {
361/* Initialize Phonet devices list */ 344/* Initialize Phonet devices list */
362int __init phonet_device_init(void) 345int __init phonet_device_init(void)
363{ 346{
364 int err = register_pernet_device(&phonet_net_ops); 347 int err = register_pernet_subsys(&phonet_net_ops);
365 if (err) 348 if (err)
366 return err; 349 return err;
367 350
@@ -377,7 +360,7 @@ void phonet_device_exit(void)
377{ 360{
378 rtnl_unregister_all(PF_PHONET); 361 rtnl_unregister_all(PF_PHONET);
379 unregister_netdevice_notifier(&phonet_device_notifier); 362 unregister_netdevice_notifier(&phonet_device_notifier);
380 unregister_pernet_device(&phonet_net_ops); 363 unregister_pernet_subsys(&phonet_net_ops);
381 proc_net_remove(&init_net, "pnresource"); 364 proc_net_remove(&init_net, "pnresource");
382} 365}
383 366
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 0b15236be7b..8179494c269 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -565,11 +565,8 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
565 opt.packets = q->packetsin; 565 opt.packets = q->packetsin;
566 opt.bytesin = q->bytesin; 566 opt.bytesin = q->bytesin;
567 567
568 if (gred_wred_mode(table)) { 568 if (gred_wred_mode(table))
569 q->vars.qidlestart = 569 gred_load_wred_set(table, q);
570 table->tab[table->def]->vars.qidlestart;
571 q->vars.qavg = table->tab[table->def]->vars.qavg;
572 }
573 570
574 opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); 571 opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg);
575 572
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index 8adfc88e793..3d6498af9ad 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -75,20 +75,21 @@ static struct pernet_operations sunrpc_net_ops = {
75static int __init 75static int __init
76init_sunrpc(void) 76init_sunrpc(void)
77{ 77{
78 int err = register_rpc_pipefs(); 78 int err = rpc_init_mempool();
79 if (err) 79 if (err)
80 goto out; 80 goto out;
81 err = rpc_init_mempool();
82 if (err)
83 goto out2;
84 err = rpcauth_init_module(); 81 err = rpcauth_init_module();
85 if (err) 82 if (err)
86 goto out3; 83 goto out2;
87 84
88 cache_initialize(); 85 cache_initialize();
89 86
90 err = register_pernet_subsys(&sunrpc_net_ops); 87 err = register_pernet_subsys(&sunrpc_net_ops);
91 if (err) 88 if (err)
89 goto out3;
90
91 err = register_rpc_pipefs();
92 if (err)
92 goto out4; 93 goto out4;
93#ifdef RPC_DEBUG 94#ifdef RPC_DEBUG
94 rpc_register_sysctl(); 95 rpc_register_sysctl();
@@ -98,11 +99,11 @@ init_sunrpc(void)
98 return 0; 99 return 0;
99 100
100out4: 101out4:
101 rpcauth_remove_module(); 102 unregister_pernet_subsys(&sunrpc_net_ops);
102out3: 103out3:
103 rpc_destroy_mempool(); 104 rpcauth_remove_module();
104out2: 105out2:
105 unregister_rpc_pipefs(); 106 rpc_destroy_mempool();
106out: 107out:
107 return err; 108 return err;
108} 109}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e49da279702..f432c57af05 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1294,6 +1294,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1294 goto bad_res; 1294 goto bad_res;
1295 } 1295 }
1296 1296
1297 if (!netif_running(netdev)) {
1298 result = -ENETDOWN;
1299 goto bad_res;
1300 }
1301
1297 nla_for_each_nested(nl_txq_params, 1302 nla_for_each_nested(nl_txq_params,
1298 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], 1303 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
1299 rem_txq_params) { 1304 rem_txq_params) {
@@ -6384,7 +6389,7 @@ static struct genl_ops nl80211_ops[] = {
6384 .doit = nl80211_get_key, 6389 .doit = nl80211_get_key,
6385 .policy = nl80211_policy, 6390 .policy = nl80211_policy,
6386 .flags = GENL_ADMIN_PERM, 6391 .flags = GENL_ADMIN_PERM,
6387 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6392 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6388 NL80211_FLAG_NEED_RTNL, 6393 NL80211_FLAG_NEED_RTNL,
6389 }, 6394 },
6390 { 6395 {
@@ -6416,7 +6421,7 @@ static struct genl_ops nl80211_ops[] = {
6416 .policy = nl80211_policy, 6421 .policy = nl80211_policy,
6417 .flags = GENL_ADMIN_PERM, 6422 .flags = GENL_ADMIN_PERM,
6418 .doit = nl80211_set_beacon, 6423 .doit = nl80211_set_beacon,
6419 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6424 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6420 NL80211_FLAG_NEED_RTNL, 6425 NL80211_FLAG_NEED_RTNL,
6421 }, 6426 },
6422 { 6427 {
@@ -6424,7 +6429,7 @@ static struct genl_ops nl80211_ops[] = {
6424 .policy = nl80211_policy, 6429 .policy = nl80211_policy,
6425 .flags = GENL_ADMIN_PERM, 6430 .flags = GENL_ADMIN_PERM,
6426 .doit = nl80211_start_ap, 6431 .doit = nl80211_start_ap,
6427 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6432 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6428 NL80211_FLAG_NEED_RTNL, 6433 NL80211_FLAG_NEED_RTNL,
6429 }, 6434 },
6430 { 6435 {
@@ -6432,7 +6437,7 @@ static struct genl_ops nl80211_ops[] = {
6432 .policy = nl80211_policy, 6437 .policy = nl80211_policy,
6433 .flags = GENL_ADMIN_PERM, 6438 .flags = GENL_ADMIN_PERM,
6434 .doit = nl80211_stop_ap, 6439 .doit = nl80211_stop_ap,
6435 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6440 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6436 NL80211_FLAG_NEED_RTNL, 6441 NL80211_FLAG_NEED_RTNL,
6437 }, 6442 },
6438 { 6443 {
@@ -6448,7 +6453,7 @@ static struct genl_ops nl80211_ops[] = {
6448 .doit = nl80211_set_station, 6453 .doit = nl80211_set_station,
6449 .policy = nl80211_policy, 6454 .policy = nl80211_policy,
6450 .flags = GENL_ADMIN_PERM, 6455 .flags = GENL_ADMIN_PERM,
6451 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6456 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6452 NL80211_FLAG_NEED_RTNL, 6457 NL80211_FLAG_NEED_RTNL,
6453 }, 6458 },
6454 { 6459 {
@@ -6464,7 +6469,7 @@ static struct genl_ops nl80211_ops[] = {
6464 .doit = nl80211_del_station, 6469 .doit = nl80211_del_station,
6465 .policy = nl80211_policy, 6470 .policy = nl80211_policy,
6466 .flags = GENL_ADMIN_PERM, 6471 .flags = GENL_ADMIN_PERM,
6467 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6472 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6468 NL80211_FLAG_NEED_RTNL, 6473 NL80211_FLAG_NEED_RTNL,
6469 }, 6474 },
6470 { 6475 {
@@ -6497,7 +6502,7 @@ static struct genl_ops nl80211_ops[] = {
6497 .doit = nl80211_del_mpath, 6502 .doit = nl80211_del_mpath,
6498 .policy = nl80211_policy, 6503 .policy = nl80211_policy,
6499 .flags = GENL_ADMIN_PERM, 6504 .flags = GENL_ADMIN_PERM,
6500 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6505 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6501 NL80211_FLAG_NEED_RTNL, 6506 NL80211_FLAG_NEED_RTNL,
6502 }, 6507 },
6503 { 6508 {
@@ -6505,7 +6510,7 @@ static struct genl_ops nl80211_ops[] = {
6505 .doit = nl80211_set_bss, 6510 .doit = nl80211_set_bss,
6506 .policy = nl80211_policy, 6511 .policy = nl80211_policy,
6507 .flags = GENL_ADMIN_PERM, 6512 .flags = GENL_ADMIN_PERM,
6508 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6513 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6509 NL80211_FLAG_NEED_RTNL, 6514 NL80211_FLAG_NEED_RTNL,
6510 }, 6515 },
6511 { 6516 {
@@ -6531,7 +6536,7 @@ static struct genl_ops nl80211_ops[] = {
6531 .doit = nl80211_get_mesh_config, 6536 .doit = nl80211_get_mesh_config,
6532 .policy = nl80211_policy, 6537 .policy = nl80211_policy,
6533 /* can be retrieved by unprivileged users */ 6538 /* can be retrieved by unprivileged users */
6534 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6539 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6535 NL80211_FLAG_NEED_RTNL, 6540 NL80211_FLAG_NEED_RTNL,
6536 }, 6541 },
6537 { 6542 {
@@ -6664,7 +6669,7 @@ static struct genl_ops nl80211_ops[] = {
6664 .doit = nl80211_setdel_pmksa, 6669 .doit = nl80211_setdel_pmksa,
6665 .policy = nl80211_policy, 6670 .policy = nl80211_policy,
6666 .flags = GENL_ADMIN_PERM, 6671 .flags = GENL_ADMIN_PERM,
6667 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6672 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6668 NL80211_FLAG_NEED_RTNL, 6673 NL80211_FLAG_NEED_RTNL,
6669 }, 6674 },
6670 { 6675 {
@@ -6672,7 +6677,7 @@ static struct genl_ops nl80211_ops[] = {
6672 .doit = nl80211_setdel_pmksa, 6677 .doit = nl80211_setdel_pmksa,
6673 .policy = nl80211_policy, 6678 .policy = nl80211_policy,
6674 .flags = GENL_ADMIN_PERM, 6679 .flags = GENL_ADMIN_PERM,
6675 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6680 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6676 NL80211_FLAG_NEED_RTNL, 6681 NL80211_FLAG_NEED_RTNL,
6677 }, 6682 },
6678 { 6683 {
@@ -6680,7 +6685,7 @@ static struct genl_ops nl80211_ops[] = {
6680 .doit = nl80211_flush_pmksa, 6685 .doit = nl80211_flush_pmksa,
6681 .policy = nl80211_policy, 6686 .policy = nl80211_policy,
6682 .flags = GENL_ADMIN_PERM, 6687 .flags = GENL_ADMIN_PERM,
6683 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6688 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6684 NL80211_FLAG_NEED_RTNL, 6689 NL80211_FLAG_NEED_RTNL,
6685 }, 6690 },
6686 { 6691 {
@@ -6840,7 +6845,7 @@ static struct genl_ops nl80211_ops[] = {
6840 .doit = nl80211_probe_client, 6845 .doit = nl80211_probe_client,
6841 .policy = nl80211_policy, 6846 .policy = nl80211_policy,
6842 .flags = GENL_ADMIN_PERM, 6847 .flags = GENL_ADMIN_PERM,
6843 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6848 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6844 NL80211_FLAG_NEED_RTNL, 6849 NL80211_FLAG_NEED_RTNL,
6845 }, 6850 },
6846 { 6851 {
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 1b7a08df933..957f2562161 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -989,7 +989,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
989 if (rdev->wiphy.software_iftypes & BIT(iftype)) 989 if (rdev->wiphy.software_iftypes & BIT(iftype))
990 continue; 990 continue;
991 for (j = 0; j < c->n_limits; j++) { 991 for (j = 0; j < c->n_limits; j++) {
992 if (!(limits[j].types & iftype)) 992 if (!(limits[j].types & BIT(iftype)))
993 continue; 993 continue;
994 if (limits[j].max < num[iftype]) 994 if (limits[j].max < num[iftype])
995 goto cont; 995 goto cont;
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index 0af7f54e4f6..af648e08e61 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -780,8 +780,10 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd,
780 if (cmd == SIOCSIWENCODEEXT) { 780 if (cmd == SIOCSIWENCODEEXT) {
781 struct iw_encode_ext *ee = (void *) extra; 781 struct iw_encode_ext *ee = (void *) extra;
782 782
783 if (iwp->length < sizeof(*ee) + ee->key_len) 783 if (iwp->length < sizeof(*ee) + ee->key_len) {
784 return -EFAULT; 784 err = -EFAULT;
785 goto out;
786 }
785 } 787 }
786 } 788 }
787 789