aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-27 13:40:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-27 13:40:30 -0500
commit7fd83b47cebb9e4fafab0ff9a058d2bebf29b8f5 (patch)
treeeb669f55b4e144afd49349f4922b78009f938ccd
parentad4b3fb7ff9940bcdb1e4cd62bd189d10fa636ba (diff)
parentae782bb16c35ce27512beeda9be6024c88f85b08 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) GRE tunnel drivers don't set the transport header properly, they also blindly deref the inner protocol ipv4 and needs some checks. Fixes from Isaku Yamahata. 2) Fix sleeps while atomic in netdevice rename code, from Eric Dumazet. 3) Fix double-spinlock in solos-pci driver, from Dan Carpenter. 4) More ARP bug fixes. Fix lockdep splat in arp_solicit() and then the bug accidentally added by that fix. From Eric Dumazet and Cong Wang. 5) Remove some __dev* annotations that slipped back in, as well as all HOTPLUG references. From Greg KH 6) RDS protocol uses wrong interfaces to access scatter-gather elements, causing a regression. From Mike Marciniszyn. 7) Fix build error in cpts driver, from Richard Cochran. 8) Fix arithmetic in packet scheduler, from Stefan Hasko. 9) Similarly, fix association during calculation of random backoff in batman-adv. From Akinobu Mita. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (21 commits) ipv6/ip6_gre: set transport header correctly ipv4/ip_gre: set transport header correctly to gre header IB/rds: suppress incompatible protocol when version is known IB/rds: Correct ib_api use with gs_dma_address/sg_dma_len net/vxlan: Use the underlying device index when joining/leaving multicast groups tcp: should drop incoming frames without ACK flag set netprio_cgroup: define sk_cgrp_prioidx only if NETPRIO_CGROUP is enabled cpts: fix a run time warn_on. cpts: fix build error by removing useless code. batman-adv: fix random jitter calculation arp: fix a regression in arp_solicit() net: sched: integer overflow fix CONFIG_HOTPLUG removal from networking core Drivers: network: more __dev* removal bridge: call br_netpoll_disable in br_add_if ipv4: arp: fix a lockdep splat in arp_solicit() tuntap: dont use a private kmem_cache net: devnet_rename_seq should be a seqcount ip_gre: fix possible use after free ip_gre: make ipgre_tunnel_xmit() not parse network header as IP unconditionally ...
-rw-r--r--drivers/atm/solos-pci.c2
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c6
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c19
-rw-r--r--drivers/net/ethernet/ti/cpts.c3
-rw-r--r--drivers/net/ethernet/ti/cpts.h1
-rw-r--r--drivers/net/tun.c24
-rw-r--r--drivers/net/vxlan.c6
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/sw.c2
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/net/sock.h2
-rw-r--r--net/batman-adv/bat_iv_ogm.c2
-rw-r--r--net/bridge/br_if.c8
-rw-r--r--net/core/dev.c18
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/core/sock.c4
-rw-r--r--net/ipv4/arp.c10
-rw-r--r--net/ipv4/ip_gre.c13
-rw-r--r--net/ipv4/tcp_input.c14
-rw-r--r--net/ipv6/ip6_gre.c3
-rw-r--r--net/rds/ib_cm.c11
-rw-r--r--net/rds/ib_recv.c9
-rw-r--r--net/sched/sch_htb.c2
-rw-r--r--net/wireless/reg.c7
-rw-r--r--net/wireless/sysfs.c4
24 files changed, 78 insertions, 98 deletions
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index d70abe77f737..d47db401027f 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -538,7 +538,7 @@ static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr
538 } else { 538 } else {
539 count = -EINVAL; 539 count = -EINVAL;
540 } 540 }
541 spin_lock_irq(&card->param_queue_lock); 541 spin_unlock_irq(&card->param_queue_lock);
542 return count; 542 return count;
543} 543}
544 544
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 6d6002bab060..74f1c157a480 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)
141 return 0; 141 return 0;
142} 142}
143 143
144static int __devinit orion_mdio_probe(struct platform_device *pdev) 144static int orion_mdio_probe(struct platform_device *pdev)
145{ 145{
146 struct device_node *np = pdev->dev.of_node; 146 struct device_node *np = pdev->dev.of_node;
147 struct mii_bus *bus; 147 struct mii_bus *bus;
@@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)
197 return 0; 197 return 0;
198} 198}
199 199
200static int __devexit orion_mdio_remove(struct platform_device *pdev) 200static int orion_mdio_remove(struct platform_device *pdev)
201{ 201{
202 struct mii_bus *bus = platform_get_drvdata(pdev); 202 struct mii_bus *bus = platform_get_drvdata(pdev);
203 mdiobus_unregister(bus); 203 mdiobus_unregister(bus);
@@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);
214 214
215static struct platform_driver orion_mdio_driver = { 215static struct platform_driver orion_mdio_driver = {
216 .probe = orion_mdio_probe, 216 .probe = orion_mdio_probe,
217 .remove = __devexit_p(orion_mdio_remove), 217 .remove = orion_mdio_remove,
218 .driver = { 218 .driver = {
219 .name = "orion-mdio", 219 .name = "orion-mdio",
220 .of_match_table = orion_mdio_match, 220 .of_match_table = orion_mdio_match,
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b9f5e5..b6025c305e10 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
635 635
636 636
637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
638static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 638static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
639{ 639{
640 u32 val; 640 u32 val;
641 641
@@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
650} 650}
651 651
652/* Config SGMII port */ 652/* Config SGMII port */
653static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp) 653static void mvneta_port_sgmii_config(struct mvneta_port *pp)
654{ 654{
655 u32 val; 655 u32 val;
656 656
@@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
2564}; 2564};
2565 2565
2566/* Initialize hw */ 2566/* Initialize hw */
2567static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr) 2567static int mvneta_init(struct mvneta_port *pp, int phy_addr)
2568{ 2568{
2569 int queue; 2569 int queue;
2570 2570
@@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)
2613} 2613}
2614 2614
2615/* platform glue : initialize decoding windows */ 2615/* platform glue : initialize decoding windows */
2616static void __devinit 2616static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
2617mvneta_conf_mbus_windows(struct mvneta_port *pp, 2617 const struct mbus_dram_target_info *dram)
2618 const struct mbus_dram_target_info *dram)
2619{ 2618{
2620 u32 win_enable; 2619 u32 win_enable;
2621 u32 win_protect; 2620 u32 win_protect;
@@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,
2648} 2647}
2649 2648
2650/* Power up the port */ 2649/* Power up the port */
2651static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2650static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2652{ 2651{
2653 u32 val; 2652 u32 val;
2654 2653
@@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2671} 2670}
2672 2671
2673/* Device initialization routine */ 2672/* Device initialization routine */
2674static int __devinit mvneta_probe(struct platform_device *pdev) 2673static int mvneta_probe(struct platform_device *pdev)
2675{ 2674{
2676 const struct mbus_dram_target_info *dram_target_info; 2675 const struct mbus_dram_target_info *dram_target_info;
2677 struct device_node *dn = pdev->dev.of_node; 2676 struct device_node *dn = pdev->dev.of_node;
@@ -2803,7 +2802,7 @@ err_free_netdev:
2803} 2802}
2804 2803
2805/* Device removal routine */ 2804/* Device removal routine */
2806static int __devexit mvneta_remove(struct platform_device *pdev) 2805static int mvneta_remove(struct platform_device *pdev)
2807{ 2806{
2808 struct net_device *dev = platform_get_drvdata(pdev); 2807 struct net_device *dev = platform_get_drvdata(pdev);
2809 struct mvneta_port *pp = netdev_priv(dev); 2808 struct mvneta_port *pp = netdev_priv(dev);
@@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);
2828 2827
2829static struct platform_driver mvneta_driver = { 2828static struct platform_driver mvneta_driver = {
2830 .probe = mvneta_probe, 2829 .probe = mvneta_probe,
2831 .remove = __devexit_p(mvneta_remove), 2830 .remove = mvneta_remove,
2832 .driver = { 2831 .driver = {
2833 .name = MVNETA_DRIVER_NAME, 2832 .name = MVNETA_DRIVER_NAME,
2834 .of_match_table = mvneta_match, 2833 .of_match_table = mvneta_match,
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 5e62c1aeeffb..463597f919f1 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)
247 cpts->refclk = NULL; 247 cpts->refclk = NULL;
248 return; 248 return;
249 } 249 }
250 clk_enable(cpts->refclk); 250 clk_prepare_enable(cpts->refclk);
251 cpts->freq = cpts->refclk->recalc(cpts->refclk);
252} 251}
253 252
254static void cpts_clk_release(struct cpts *cpts) 253static void cpts_clk_release(struct cpts *cpts)
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index e1bba3a496b2..fe993cdd7e23 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -120,7 +120,6 @@ struct cpts {
120 struct delayed_work overflow_work; 120 struct delayed_work overflow_work;
121 int phc_index; 121 int phc_index;
122 struct clk *refclk; 122 struct clk *refclk;
123 unsigned long freq;
124 struct list_head events; 123 struct list_head events;
125 struct list_head pool; 124 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS]; 125 struct cpts_event pool_data[CPTS_MAX_EVENTS];
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 504f7f1cad94..fbd106edbe59 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -180,7 +180,6 @@ struct tun_struct {
180 int debug; 180 int debug;
181#endif 181#endif
182 spinlock_t lock; 182 spinlock_t lock;
183 struct kmem_cache *flow_cache;
184 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; 183 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
185 struct timer_list flow_gc_timer; 184 struct timer_list flow_gc_timer;
186 unsigned long ageing_time; 185 unsigned long ageing_time;
@@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
209 struct hlist_head *head, 208 struct hlist_head *head,
210 u32 rxhash, u16 queue_index) 209 u32 rxhash, u16 queue_index)
211{ 210{
212 struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, 211 struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);
213 GFP_ATOMIC); 212
214 if (e) { 213 if (e) {
215 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", 214 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",
216 rxhash, queue_index); 215 rxhash, queue_index);
@@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
223 return e; 222 return e;
224} 223}
225 224
226static void tun_flow_free(struct rcu_head *head)
227{
228 struct tun_flow_entry *e
229 = container_of(head, struct tun_flow_entry, rcu);
230 kmem_cache_free(e->tun->flow_cache, e);
231}
232
233static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) 225static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)
234{ 226{
235 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", 227 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",
236 e->rxhash, e->queue_index); 228 e->rxhash, e->queue_index);
237 hlist_del_rcu(&e->hash_link); 229 hlist_del_rcu(&e->hash_link);
238 call_rcu(&e->rcu, tun_flow_free); 230 kfree_rcu(e, rcu);
239} 231}
240 232
241static void tun_flow_flush(struct tun_struct *tun) 233static void tun_flow_flush(struct tun_struct *tun)
@@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun)
833{ 825{
834 int i; 826 int i;
835 827
836 tun->flow_cache = kmem_cache_create("tun_flow_cache",
837 sizeof(struct tun_flow_entry), 0, 0,
838 NULL);
839 if (!tun->flow_cache)
840 return -ENOMEM;
841
842 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) 828 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)
843 INIT_HLIST_HEAD(&tun->flows[i]); 829 INIT_HLIST_HEAD(&tun->flows[i]);
844 830
@@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun)
854{ 840{
855 del_timer_sync(&tun->flow_gc_timer); 841 del_timer_sync(&tun->flow_gc_timer);
856 tun_flow_flush(tun); 842 tun_flow_flush(tun);
857
858 /* Wait for completion of call_rcu()'s */
859 rcu_barrier();
860 kmem_cache_destroy(tun->flow_cache);
861} 843}
862 844
863/* Initialize net device. */ 845/* Initialize net device. */
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b3fdf648ea7..40f2cc135a49 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)
505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
506 struct sock *sk = vn->sock->sk; 506 struct sock *sk = vn->sock->sk;
507 struct ip_mreqn mreq = { 507 struct ip_mreqn mreq = {
508 .imr_multiaddr.s_addr = vxlan->gaddr, 508 .imr_multiaddr.s_addr = vxlan->gaddr,
509 .imr_ifindex = vxlan->link,
509 }; 510 };
510 int err; 511 int err;
511 512
@@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)
532 int err = 0; 533 int err = 0;
533 struct sock *sk = vn->sock->sk; 534 struct sock *sk = vn->sock->sk;
534 struct ip_mreqn mreq = { 535 struct ip_mreqn mreq = {
535 .imr_multiaddr.s_addr = vxlan->gaddr, 536 .imr_multiaddr.s_addr = vxlan->gaddr,
537 .imr_ifindex = vxlan->link,
536 }; 538 };
537 539
538 /* Only leave group when last vxlan is done. */ 540 /* Only leave group when last vxlan is done. */
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index 18b0bc51766b..bb7cc90bafb2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
342}; 342};
343 343
344static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = { 344static struct pci_device_id rtl8723ae_pci_ids[] = {
345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)}, 345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},
346 {}, 346 {},
347}; 347};
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 02e0f6b156c3..c599e4782d45 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1576,7 +1576,7 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1576 1576
1577extern rwlock_t dev_base_lock; /* Device list lock */ 1577extern rwlock_t dev_base_lock; /* Device list lock */
1578 1578
1579extern seqlock_t devnet_rename_seq; /* Device rename lock */ 1579extern seqcount_t devnet_rename_seq; /* Device rename seq */
1580 1580
1581 1581
1582#define for_each_netdev(net, d) \ 1582#define for_each_netdev(net, d) \
diff --git a/include/net/sock.h b/include/net/sock.h
index 93a6745bfdb2..182ca99405ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -367,7 +367,7 @@ struct sock {
367 unsigned short sk_ack_backlog; 367 unsigned short sk_ack_backlog;
368 unsigned short sk_max_ack_backlog; 368 unsigned short sk_max_ack_backlog;
369 __u32 sk_priority; 369 __u32 sk_priority;
370#ifdef CONFIG_CGROUPS 370#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
371 __u32 sk_cgrp_prioidx; 371 __u32 sk_cgrp_prioidx;
372#endif 372#endif
373 struct pid *sk_peer_pid; 373 struct pid *sk_peer_pid;
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 9f3925a85aab..7d02ebd11a7f 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
123 unsigned int msecs; 123 unsigned int msecs;
124 124
125 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; 125 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
126 msecs += (random32() % 2 * BATADV_JITTER); 126 msecs += random32() % (2 * BATADV_JITTER);
127 127
128 return jiffies + msecs_to_jiffies(msecs); 128 return jiffies + msecs_to_jiffies(msecs);
129} 129}
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1c8fdc3558cd..37fe693471a8 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -366,11 +366,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
366 366
367 err = netdev_set_master(dev, br->dev); 367 err = netdev_set_master(dev, br->dev);
368 if (err) 368 if (err)
369 goto err3; 369 goto err4;
370 370
371 err = netdev_rx_handler_register(dev, br_handle_frame, p); 371 err = netdev_rx_handler_register(dev, br_handle_frame, p);
372 if (err) 372 if (err)
373 goto err4; 373 goto err5;
374 374
375 dev->priv_flags |= IFF_BRIDGE_PORT; 375 dev->priv_flags |= IFF_BRIDGE_PORT;
376 376
@@ -402,8 +402,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
402 402
403 return 0; 403 return 0;
404 404
405err4: 405err5:
406 netdev_set_master(dev, NULL); 406 netdev_set_master(dev, NULL);
407err4:
408 br_netpoll_disable(p);
407err3: 409err3:
408 sysfs_remove_link(br->ifobj, p->dev->name); 410 sysfs_remove_link(br->ifobj, p->dev->name);
409err2: 411err2:
diff --git a/net/core/dev.c b/net/core/dev.c
index d0cbc93fcf32..515473ee52cb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -203,7 +203,7 @@ static struct list_head offload_base __read_mostly;
203DEFINE_RWLOCK(dev_base_lock); 203DEFINE_RWLOCK(dev_base_lock);
204EXPORT_SYMBOL(dev_base_lock); 204EXPORT_SYMBOL(dev_base_lock);
205 205
206DEFINE_SEQLOCK(devnet_rename_seq); 206seqcount_t devnet_rename_seq;
207 207
208static inline void dev_base_seq_inc(struct net *net) 208static inline void dev_base_seq_inc(struct net *net)
209{ 209{
@@ -1093,10 +1093,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
1093 if (dev->flags & IFF_UP) 1093 if (dev->flags & IFF_UP)
1094 return -EBUSY; 1094 return -EBUSY;
1095 1095
1096 write_seqlock(&devnet_rename_seq); 1096 write_seqcount_begin(&devnet_rename_seq);
1097 1097
1098 if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { 1098 if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
1099 write_sequnlock(&devnet_rename_seq); 1099 write_seqcount_end(&devnet_rename_seq);
1100 return 0; 1100 return 0;
1101 } 1101 }
1102 1102
@@ -1104,7 +1104,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
1104 1104
1105 err = dev_get_valid_name(net, dev, newname); 1105 err = dev_get_valid_name(net, dev, newname);
1106 if (err < 0) { 1106 if (err < 0) {
1107 write_sequnlock(&devnet_rename_seq); 1107 write_seqcount_end(&devnet_rename_seq);
1108 return err; 1108 return err;
1109 } 1109 }
1110 1110
@@ -1112,11 +1112,11 @@ rollback:
1112 ret = device_rename(&dev->dev, dev->name); 1112 ret = device_rename(&dev->dev, dev->name);
1113 if (ret) { 1113 if (ret) {
1114 memcpy(dev->name, oldname, IFNAMSIZ); 1114 memcpy(dev->name, oldname, IFNAMSIZ);
1115 write_sequnlock(&devnet_rename_seq); 1115 write_seqcount_end(&devnet_rename_seq);
1116 return ret; 1116 return ret;
1117 } 1117 }
1118 1118
1119 write_sequnlock(&devnet_rename_seq); 1119 write_seqcount_end(&devnet_rename_seq);
1120 1120
1121 write_lock_bh(&dev_base_lock); 1121 write_lock_bh(&dev_base_lock);
1122 hlist_del_rcu(&dev->name_hlist); 1122 hlist_del_rcu(&dev->name_hlist);
@@ -1135,7 +1135,7 @@ rollback:
1135 /* err >= 0 after dev_alloc_name() or stores the first errno */ 1135 /* err >= 0 after dev_alloc_name() or stores the first errno */
1136 if (err >= 0) { 1136 if (err >= 0) {
1137 err = ret; 1137 err = ret;
1138 write_seqlock(&devnet_rename_seq); 1138 write_seqcount_begin(&devnet_rename_seq);
1139 memcpy(dev->name, oldname, IFNAMSIZ); 1139 memcpy(dev->name, oldname, IFNAMSIZ);
1140 goto rollback; 1140 goto rollback;
1141 } else { 1141 } else {
@@ -4180,7 +4180,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
4180 return -EFAULT; 4180 return -EFAULT;
4181 4181
4182retry: 4182retry:
4183 seq = read_seqbegin(&devnet_rename_seq); 4183 seq = read_seqcount_begin(&devnet_rename_seq);
4184 rcu_read_lock(); 4184 rcu_read_lock();
4185 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex); 4185 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);
4186 if (!dev) { 4186 if (!dev) {
@@ -4190,7 +4190,7 @@ retry:
4190 4190
4191 strcpy(ifr.ifr_name, dev->name); 4191 strcpy(ifr.ifr_name, dev->name);
4192 rcu_read_unlock(); 4192 rcu_read_unlock();
4193 if (read_seqretry(&devnet_rename_seq, seq)) 4193 if (read_seqcount_retry(&devnet_rename_seq, seq))
4194 goto retry; 4194 goto retry;
4195 4195
4196 if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) 4196 if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 334efd5d67a9..28c5f5aa7ca7 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1334,7 +1334,6 @@ struct kobj_ns_type_operations net_ns_type_operations = {
1334}; 1334};
1335EXPORT_SYMBOL_GPL(net_ns_type_operations); 1335EXPORT_SYMBOL_GPL(net_ns_type_operations);
1336 1336
1337#ifdef CONFIG_HOTPLUG
1338static int netdev_uevent(struct device *d, struct kobj_uevent_env *env) 1337static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1339{ 1338{
1340 struct net_device *dev = to_net_dev(d); 1339 struct net_device *dev = to_net_dev(d);
@@ -1353,7 +1352,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1353exit: 1352exit:
1354 return retval; 1353 return retval;
1355} 1354}
1356#endif
1357 1355
1358/* 1356/*
1359 * netdev_release -- destroy and free a dead device. 1357 * netdev_release -- destroy and free a dead device.
@@ -1382,9 +1380,7 @@ static struct class net_class = {
1382#ifdef CONFIG_SYSFS 1380#ifdef CONFIG_SYSFS
1383 .dev_attrs = net_class_attributes, 1381 .dev_attrs = net_class_attributes,
1384#endif /* CONFIG_SYSFS */ 1382#endif /* CONFIG_SYSFS */
1385#ifdef CONFIG_HOTPLUG
1386 .dev_uevent = netdev_uevent, 1383 .dev_uevent = netdev_uevent,
1387#endif
1388 .ns_type = &net_ns_type_operations, 1384 .ns_type = &net_ns_type_operations,
1389 .namespace = net_namespace, 1385 .namespace = net_namespace,
1390}; 1386};
diff --git a/net/core/sock.c b/net/core/sock.c
index a692ef49c9bb..bc131d419683 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -583,7 +583,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
583 goto out; 583 goto out;
584 584
585retry: 585retry:
586 seq = read_seqbegin(&devnet_rename_seq); 586 seq = read_seqcount_begin(&devnet_rename_seq);
587 rcu_read_lock(); 587 rcu_read_lock();
588 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); 588 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
589 ret = -ENODEV; 589 ret = -ENODEV;
@@ -594,7 +594,7 @@ retry:
594 594
595 strcpy(devname, dev->name); 595 strcpy(devname, dev->name);
596 rcu_read_unlock(); 596 rcu_read_unlock();
597 if (read_seqretry(&devnet_rename_seq, seq)) 597 if (read_seqcount_retry(&devnet_rename_seq, seq))
598 goto retry; 598 goto retry;
599 599
600 len = strlen(devname) + 1; 600 len = strlen(devname) + 1;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index ce6fbdfd40b8..9547a273b9e9 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
321static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) 321static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
322{ 322{
323 __be32 saddr = 0; 323 __be32 saddr = 0;
324 u8 *dst_ha = NULL; 324 u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
325 struct net_device *dev = neigh->dev; 325 struct net_device *dev = neigh->dev;
326 __be32 target = *(__be32 *)neigh->primary_key; 326 __be32 target = *(__be32 *)neigh->primary_key;
327 int probes = atomic_read(&neigh->probes); 327 int probes = atomic_read(&neigh->probes);
@@ -363,8 +363,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
363 if (probes < 0) { 363 if (probes < 0) {
364 if (!(neigh->nud_state & NUD_VALID)) 364 if (!(neigh->nud_state & NUD_VALID))
365 pr_debug("trying to ucast probe in NUD_INVALID\n"); 365 pr_debug("trying to ucast probe in NUD_INVALID\n");
366 dst_ha = neigh->ha; 366 neigh_ha_snapshot(dst_ha, neigh, dev);
367 read_lock_bh(&neigh->lock); 367 dst_hw = dst_ha;
368 } else { 368 } else {
369 probes -= neigh->parms->app_probes; 369 probes -= neigh->parms->app_probes;
370 if (probes < 0) { 370 if (probes < 0) {
@@ -376,9 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
376 } 376 }
377 377
378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, 378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
379 dst_ha, dev->dev_addr, NULL); 379 dst_hw, dev->dev_addr, NULL);
380 if (dst_ha)
381 read_unlock_bh(&neigh->lock);
382} 380}
383 381
384static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) 382static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index a85ae2f7a21c..303012adf9e6 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -750,6 +750,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
750 int gre_hlen; 750 int gre_hlen;
751 __be32 dst; 751 __be32 dst;
752 int mtu; 752 int mtu;
753 u8 ttl;
753 754
754 if (skb->ip_summed == CHECKSUM_PARTIAL && 755 if (skb->ip_summed == CHECKSUM_PARTIAL &&
755 skb_checksum_help(skb)) 756 skb_checksum_help(skb))
@@ -760,7 +761,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
760 761
761 if (dev->header_ops && dev->type == ARPHRD_IPGRE) { 762 if (dev->header_ops && dev->type == ARPHRD_IPGRE) {
762 gre_hlen = 0; 763 gre_hlen = 0;
763 tiph = (const struct iphdr *)skb->data; 764 if (skb->protocol == htons(ETH_P_IP))
765 tiph = (const struct iphdr *)skb->data;
766 else
767 tiph = &tunnel->parms.iph;
764 } else { 768 } else {
765 gre_hlen = tunnel->hlen; 769 gre_hlen = tunnel->hlen;
766 tiph = &tunnel->parms.iph; 770 tiph = &tunnel->parms.iph;
@@ -812,6 +816,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
812 goto tx_error; 816 goto tx_error;
813 } 817 }
814 818
819 ttl = tiph->ttl;
815 tos = tiph->tos; 820 tos = tiph->tos;
816 if (tos == 1) { 821 if (tos == 1) {
817 tos = 0; 822 tos = 0;
@@ -904,11 +909,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
904 dev_kfree_skb(skb); 909 dev_kfree_skb(skb);
905 skb = new_skb; 910 skb = new_skb;
906 old_iph = ip_hdr(skb); 911 old_iph = ip_hdr(skb);
912 /* Warning : tiph value might point to freed memory */
907 } 913 }
908 914
909 skb_reset_transport_header(skb);
910 skb_push(skb, gre_hlen); 915 skb_push(skb, gre_hlen);
911 skb_reset_network_header(skb); 916 skb_reset_network_header(skb);
917 skb_set_transport_header(skb, sizeof(*iph));
912 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 918 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
913 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 919 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
914 IPSKB_REROUTED); 920 IPSKB_REROUTED);
@@ -927,8 +933,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
927 iph->tos = ipgre_ecn_encapsulate(tos, old_iph, skb); 933 iph->tos = ipgre_ecn_encapsulate(tos, old_iph, skb);
928 iph->daddr = fl4.daddr; 934 iph->daddr = fl4.daddr;
929 iph->saddr = fl4.saddr; 935 iph->saddr = fl4.saddr;
936 iph->ttl = ttl;
930 937
931 if ((iph->ttl = tiph->ttl) == 0) { 938 if (ttl == 0) {
932 if (skb->protocol == htons(ETH_P_IP)) 939 if (skb->protocol == htons(ETH_P_IP))
933 iph->ttl = old_iph->ttl; 940 iph->ttl = old_iph->ttl;
934#if IS_ENABLED(CONFIG_IPV6) 941#if IS_ENABLED(CONFIG_IPV6)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a13692560e63..a28e4db8a952 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5543,6 +5543,9 @@ slow_path:
5543 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) 5543 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb))
5544 goto csum_error; 5544 goto csum_error;
5545 5545
5546 if (!th->ack)
5547 goto discard;
5548
5546 /* 5549 /*
5547 * Standard slow path. 5550 * Standard slow path.
5548 */ 5551 */
@@ -5551,7 +5554,7 @@ slow_path:
5551 return 0; 5554 return 0;
5552 5555
5553step5: 5556step5:
5554 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) 5557 if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)
5555 goto discard; 5558 goto discard;
5556 5559
5557 /* ts_recent update must be made after we are sure that the packet 5560 /* ts_recent update must be made after we are sure that the packet
@@ -5984,11 +5987,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5984 if (tcp_check_req(sk, skb, req, NULL, true) == NULL) 5987 if (tcp_check_req(sk, skb, req, NULL, true) == NULL)
5985 goto discard; 5988 goto discard;
5986 } 5989 }
5990
5991 if (!th->ack)
5992 goto discard;
5993
5987 if (!tcp_validate_incoming(sk, skb, th, 0)) 5994 if (!tcp_validate_incoming(sk, skb, th, 0))
5988 return 0; 5995 return 0;
5989 5996
5990 /* step 5: check the ACK field */ 5997 /* step 5: check the ACK field */
5991 if (th->ack) { 5998 if (true) {
5992 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; 5999 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0;
5993 6000
5994 switch (sk->sk_state) { 6001 switch (sk->sk_state) {
@@ -6138,8 +6145,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6138 } 6145 }
6139 break; 6146 break;
6140 } 6147 }
6141 } else 6148 }
6142 goto discard;
6143 6149
6144 /* ts_recent update must be made after we are sure that the packet 6150 /* ts_recent update must be made after we are sure that the packet
6145 * is in window. 6151 * is in window.
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 867466c96aac..c727e4712751 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -758,8 +758,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
758 skb_dst_set_noref(skb, dst); 758 skb_dst_set_noref(skb, dst);
759 } 759 }
760 760
761 skb->transport_header = skb->network_header;
762
763 proto = NEXTHDR_GRE; 761 proto = NEXTHDR_GRE;
764 if (encap_limit >= 0) { 762 if (encap_limit >= 0) {
765 init_tel_txopt(&opt, encap_limit); 763 init_tel_txopt(&opt, encap_limit);
@@ -768,6 +766,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
768 766
769 skb_push(skb, gre_hlen); 767 skb_push(skb, gre_hlen);
770 skb_reset_network_header(skb); 768 skb_reset_network_header(skb);
769 skb_set_transport_header(skb, sizeof(*ipv6h));
771 770
772 /* 771 /*
773 * Push down and install the IP header. 772 * Push down and install the IP header.
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index a1e116277477..31b74f5e61ad 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -434,12 +434,11 @@ static u32 rds_ib_protocol_compatible(struct rdma_cm_event *event)
434 version = RDS_PROTOCOL_3_0; 434 version = RDS_PROTOCOL_3_0;
435 while ((common >>= 1) != 0) 435 while ((common >>= 1) != 0)
436 version++; 436 version++;
437 } 437 } else
438 printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using " 438 printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using incompatible protocol version %u.%u\n",
439 "incompatible protocol version %u.%u\n", 439 &dp->dp_saddr,
440 &dp->dp_saddr, 440 dp->dp_protocol_major,
441 dp->dp_protocol_major, 441 dp->dp_protocol_minor);
442 dp->dp_protocol_minor);
443 return version; 442 return version;
444} 443}
445 444
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 8c5bc857f04d..8eb9501e3d60 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -339,8 +339,8 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,
339 sge->length = sizeof(struct rds_header); 339 sge->length = sizeof(struct rds_header);
340 340
341 sge = &recv->r_sge[1]; 341 sge = &recv->r_sge[1];
342 sge->addr = sg_dma_address(&recv->r_frag->f_sg); 342 sge->addr = ib_sg_dma_address(ic->i_cm_id->device, &recv->r_frag->f_sg);
343 sge->length = sg_dma_len(&recv->r_frag->f_sg); 343 sge->length = ib_sg_dma_len(ic->i_cm_id->device, &recv->r_frag->f_sg);
344 344
345 ret = 0; 345 ret = 0;
346out: 346out:
@@ -381,7 +381,10 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill)
381 ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr); 381 ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr);
382 rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv, 382 rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv,
383 recv->r_ibinc, sg_page(&recv->r_frag->f_sg), 383 recv->r_ibinc, sg_page(&recv->r_frag->f_sg),
384 (long) sg_dma_address(&recv->r_frag->f_sg), ret); 384 (long) ib_sg_dma_address(
385 ic->i_cm_id->device,
386 &recv->r_frag->f_sg),
387 ret);
385 if (ret) { 388 if (ret) {
386 rds_ib_conn_error(conn, "recv post on " 389 rds_ib_conn_error(conn, "recv post on "
387 "%pI4 returned %d, disconnecting and " 390 "%pI4 returned %d, disconnecting and "
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0ef57a..51561eafcb72 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
919 q->now = ktime_to_ns(ktime_get()); 919 q->now = ktime_to_ns(ktime_get());
920 start_at = jiffies; 920 start_at = jiffies;
921 921
922 next_event = q->now + 5 * NSEC_PER_SEC; 922 next_event = q->now + 5LLU * NSEC_PER_SEC;
923 923
924 for (level = 0; level < TC_HTB_MAXDEPTH; level++) { 924 for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
925 /* common case optimization - skip event handler quickly */ 925 /* common case optimization - skip event handler quickly */
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6e5308998e30..82c4fc7c994c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2365,7 +2365,6 @@ int set_regdom(const struct ieee80211_regdomain *rd)
2365 return r; 2365 return r;
2366} 2366}
2367 2367
2368#ifdef CONFIG_HOTPLUG
2369int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) 2368int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2370{ 2369{
2371 if (last_request && !last_request->processed) { 2370 if (last_request && !last_request->processed) {
@@ -2377,12 +2376,6 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2377 2376
2378 return 0; 2377 return 0;
2379} 2378}
2380#else
2381int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2382{
2383 return -ENODEV;
2384}
2385#endif /* CONFIG_HOTPLUG */
2386 2379
2387void wiphy_regulatory_register(struct wiphy *wiphy) 2380void wiphy_regulatory_register(struct wiphy *wiphy)
2388{ 2381{
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 9bf6d5e32166..1f6f01e2dc4c 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -77,13 +77,11 @@ static void wiphy_dev_release(struct device *dev)
77 cfg80211_dev_free(rdev); 77 cfg80211_dev_free(rdev);
78} 78}
79 79
80#ifdef CONFIG_HOTPLUG
81static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env) 80static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
82{ 81{
83 /* TODO, we probably need stuff here */ 82 /* TODO, we probably need stuff here */
84 return 0; 83 return 0;
85} 84}
86#endif
87 85
88static int wiphy_suspend(struct device *dev, pm_message_t state) 86static int wiphy_suspend(struct device *dev, pm_message_t state)
89{ 87{
@@ -134,9 +132,7 @@ struct class ieee80211_class = {
134 .owner = THIS_MODULE, 132 .owner = THIS_MODULE,
135 .dev_release = wiphy_dev_release, 133 .dev_release = wiphy_dev_release,
136 .dev_attrs = ieee80211_dev_attrs, 134 .dev_attrs = ieee80211_dev_attrs,
137#ifdef CONFIG_HOTPLUG
138 .dev_uevent = wiphy_uevent, 135 .dev_uevent = wiphy_uevent,
139#endif
140 .suspend = wiphy_suspend, 136 .suspend = wiphy_suspend,
141 .resume = wiphy_resume, 137 .resume = wiphy_resume,
142 .ns_type = &net_ns_type_operations, 138 .ns_type = &net_ns_type_operations,