Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) We've discovered a common error in several networking drivers, they
put VLAN offload features into ->vlan_features, which would suggest
that they support offloading 2 or more levels of VLAN encapsulation.
Not only do these devices not do that, but we don't have the
infrastructure yet to handle that at all.

Fixes from Vlad Yasevich.

2) Fix tcpdump crash with bridging and vlans, also from Vlad.

3) Some MAINTAINERS updates for random32 and bonding.

4) Fix late reseeds of prandom generator, from Sasha Levin.

5) Bridge doesn't handle stacked vlans properly, fix from Toshiaki
Makita.

6) Fix deadlock in openvswitch, from Flavio Leitner.

7) get_timewait4_sock() doesn't report delay times correctly, fix from
Eric Dumazet.

8) Duplicate address detection and addrconf verification need to run in
contexts where RTNL can be obtained. Move them to run from a
workqueue. From Hannes Frederic Sowa.

9) Fix route refcount leaking in ip tunnels, from Pravin B Shelar.

10) Don't return -EINTR from non-blocking recvmsg() on AF_UNIX sockets,
from Eric Dumazet.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (28 commits)
vlan: Warn the user if lowerdev has bad vlan features.
veth: Turn off vlan rx acceleration in vlan_features
ifb: Remove vlan acceleration from vlan_features
qlge: Do not propaged vlan tag offloads to vlans
bridge: Fix crash with vlan filtering and tcpdump
net: Account for all vlan headers in skb_mac_gso_segment
MAINTAINERS: bonding: change email address
MAINTAINERS: bonding: change email address
ipv6: move DAD and addrconf_verify processing to workqueue
tcp: fix get_timewait4_sock() delay computation on 64bit
openvswitch: fix a possible deadlock and lockdep warning
bridge: Fix handling stacked vlan tags
bridge: Fix inabillity to retrieve vlan tags when tx offload is disabled
vhost: validate vhost_get_vq_desc return value
vhost: fix total length when packets are too short
random32: avoid attempt to late reseed if in the middle of seeding
random32: assign to network folks in MAINTAINERS
net/mlx4_core: pass pci_device_id.driver_data to __mlx4_init_one during reset
core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors
vlan: Set hard_header_len according to available acceleration
...

+363 -195
+3 -2
MAINTAINERS
··· 1832 1832 F: include/net/bluetooth/ 1833 1833 1834 1834 BONDING DRIVER 1835 - M: Jay Vosburgh <fubar@us.ibm.com> 1836 - M: Veaceslav Falico <vfalico@redhat.com> 1835 + M: Jay Vosburgh <j.vosburgh@gmail.com> 1836 + M: Veaceslav Falico <vfalico@gmail.com> 1837 1837 M: Andy Gospodarek <andy@greyhouse.net> 1838 1838 L: netdev@vger.kernel.org 1839 1839 W: http://sourceforge.net/projects/bonding/ ··· 6006 6006 F: include/uapi/linux/netdevice.h 6007 6007 F: tools/net/ 6008 6008 F: tools/testing/selftests/net/ 6009 + F: lib/random32.c 6009 6010 6010 6011 NETWORKING [IPv4/IPv6] 6011 6012 M: "David S. Miller" <davem@davemloft.net>
+2 -3
drivers/net/ethernet/broadcom/tg3.c
··· 17649 17649 17650 17650 tg3_init_bufmgr_config(tp); 17651 17651 17652 - features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; 17653 - 17654 17652 /* 5700 B0 chips do not support checksumming correctly due 17655 17653 * to hardware bugs. 17656 17654 */ ··· 17680 17682 features |= NETIF_F_TSO_ECN; 17681 17683 } 17682 17684 17683 - dev->features |= features; 17685 + dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX | 17686 + NETIF_F_HW_VLAN_CTAG_RX; 17684 17687 dev->vlan_features |= features; 17685 17688 17686 17689 /*
+20 -40
drivers/net/ethernet/marvell/mvneta.c
··· 22 22 #include <linux/interrupt.h> 23 23 #include <net/ip.h> 24 24 #include <net/ipv6.h> 25 + #include <linux/io.h> 25 26 #include <linux/of.h> 26 27 #include <linux/of_irq.h> 27 28 #include <linux/of_mdio.h> ··· 89 88 #define MVNETA_TX_IN_PRGRS BIT(1) 90 89 #define MVNETA_TX_FIFO_EMPTY BIT(8) 91 90 #define MVNETA_RX_MIN_FRAME_SIZE 0x247c 92 - #define MVNETA_SGMII_SERDES_CFG 0x24A0 91 + #define MVNETA_SERDES_CFG 0x24A0 93 92 #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 93 + #define MVNETA_RGMII_SERDES_PROTO 0x0667 94 94 #define MVNETA_TYPE_PRIO 0x24bc 95 95 #define MVNETA_FORCE_UNI BIT(21) 96 96 #define MVNETA_TXQ_CMD_1 0x24e4 ··· 163 161 #define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc 164 162 #define MVNETA_GMAC0_PORT_ENABLE BIT(0) 165 163 #define MVNETA_GMAC_CTRL_2 0x2c08 166 - #define MVNETA_GMAC2_PSC_ENABLE BIT(3) 164 + #define MVNETA_GMAC2_PCS_ENABLE BIT(3) 167 165 #define MVNETA_GMAC2_PORT_RGMII BIT(4) 168 166 #define MVNETA_GMAC2_PORT_RESET BIT(6) 169 167 #define MVNETA_GMAC_STATUS 0x2c10 ··· 710 708 val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id)); 711 709 val &= ~MVNETA_RXQ_HW_BUF_ALLOC; 712 710 mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val); 713 - } 714 - 715 - 716 - 717 - /* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 718 - static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 719 - { 720 - u32 val; 721 - 722 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 723 - 724 - if (enable) 725 - val |= MVNETA_GMAC2_PORT_RGMII; 726 - else 727 - val &= ~MVNETA_GMAC2_PORT_RGMII; 728 - 729 - mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 730 - } 731 - 732 - /* Config SGMII port */ 733 - static void mvneta_port_sgmii_config(struct mvneta_port *pp) 734 - { 735 - u32 val; 736 - 737 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 738 - val |= MVNETA_GMAC2_PSC_ENABLE; 739 - mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 740 - 741 - mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); 742 711 } 743 712 744 713 /* Start the Ethernet port RX and TX activity */ ··· 2729 2756 mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); 2730 2757 2731 2758 if (phy_mode == PHY_INTERFACE_MODE_SGMII) 2732 - mvneta_port_sgmii_config(pp); 2759 + mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); 2760 + else 2761 + mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_RGMII_SERDES_PROTO); 2733 2762 2734 - mvneta_gmac_rgmii_set(pp, 1); 2763 + val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 2764 + 2765 + val |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; 2735 2766 2736 2767 /* Cancel Port Reset */ 2737 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 2738 2768 val &= ~MVNETA_GMAC2_PORT_RESET; 2739 2769 mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 2740 2770 ··· 2750 2774 static int mvneta_probe(struct platform_device *pdev) 2751 2775 { 2752 2776 const struct mbus_dram_target_info *dram_target_info; 2777 + struct resource *res; 2753 2778 struct device_node *dn = pdev->dev.of_node; 2754 2779 struct device_node *phy_node; 2755 2780 u32 phy_addr; ··· 2815 2838 2816 2839 clk_prepare_enable(pp->clk); 2817 2840 2818 - pp->base = of_iomap(dn, 0); 2841 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2842 + if (!res) { 2843 + err = -ENODEV; 2844 + goto err_clk; 2845 + } 2846 + 2847 + pp->base = devm_ioremap_resource(&pdev->dev, res); 2819 2848 if (pp->base == NULL) { 2820 - err = -ENOMEM; 2849 + err = PTR_ERR(pp->base); 2821 2850 goto err_clk; 2822 2851 } 2823 2852 ··· 2831 2848 pp->stats = alloc_percpu(struct mvneta_pcpu_stats); 2832 2849 if (!pp->stats) { 2833 2850 err = -ENOMEM; 2834 - goto err_unmap; 2851 + goto err_clk; 2835 2852 } 2836 2853 2837 2854 for_each_possible_cpu(cpu) { ··· 2896 2913 mvneta_deinit(pp); 2897 2914 err_free_stats: 2898 2915 free_percpu(pp->stats); 2899 - err_unmap: 2900 - iounmap(pp->base); 2901 2916 err_clk: 2902 2917 clk_disable_unprepare(pp->clk); 2903 2918 err_free_irq: ··· 2915 2934 mvneta_deinit(pp); 2916 2935 clk_disable_unprepare(pp->clk); 2917 2936 free_percpu(pp->stats); 2918 - iounmap(pp->base); 2919 2937 irq_dispose_mapping(dev->irq); 2920 2938 free_netdev(dev); 2921 2939
+5 -1
drivers/net/ethernet/mellanox/mlx4/main.c
··· 2681 2681 2682 2682 static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) 2683 2683 { 2684 - int ret = __mlx4_init_one(pdev, 0); 2684 + const struct pci_device_id *id; 2685 + int ret; 2686 + 2687 + id = pci_match_id(mlx4_pci_table, pdev); 2688 + ret = __mlx4_init_one(pdev, id->driver_data); 2685 2689 2686 2690 return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; 2687 2691 }
+3 -1
drivers/net/ethernet/qlogic/qlge/qlge_main.c
··· 4765 4765 ndev->features = ndev->hw_features; 4766 4766 ndev->vlan_features = ndev->hw_features; 4767 4767 /* vlan gets same features (except vlan filter) */ 4768 - ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; 4768 + ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER | 4769 + NETIF_F_HW_VLAN_CTAG_TX | 4770 + NETIF_F_HW_VLAN_CTAG_RX); 4769 4771 4770 4772 if (test_bit(QL_DMA64, &qdev->flags)) 4771 4773 ndev->features |= NETIF_F_HIGHDMA;
+2 -1
drivers/net/ifb.c
··· 180 180 dev->tx_queue_len = TX_Q_LIMIT; 181 181 182 182 dev->features |= IFB_FEATURES; 183 - dev->vlan_features |= IFB_FEATURES; 183 + dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX | 184 + NETIF_F_HW_VLAN_STAG_TX); 184 185 185 186 dev->flags |= IFF_NOARP; 186 187 dev->flags &= ~IFF_MULTICAST;
+19 -14
drivers/net/usb/usbnet.c
··· 752 752 // precondition: never called in_interrupt 753 753 static void usbnet_terminate_urbs(struct usbnet *dev) 754 754 { 755 - DECLARE_WAIT_QUEUE_HEAD_ONSTACK(unlink_wakeup); 756 755 DECLARE_WAITQUEUE(wait, current); 757 756 int temp; 758 757 759 758 /* ensure there are no more active urbs */ 760 - add_wait_queue(&unlink_wakeup, &wait); 759 + add_wait_queue(&dev->wait, &wait); 761 760 set_current_state(TASK_UNINTERRUPTIBLE); 762 - dev->wait = &unlink_wakeup; 763 761 temp = unlink_urbs(dev, &dev->txq) + 764 762 unlink_urbs(dev, &dev->rxq); 765 763 ··· 771 773 "waited for %d urb completions\n", temp); 772 774 } 773 775 set_current_state(TASK_RUNNING); 774 - dev->wait = NULL; 775 - remove_wait_queue(&unlink_wakeup, &wait); 776 + remove_wait_queue(&dev->wait, &wait); 776 777 } 777 778 778 779 int usbnet_stop (struct net_device *net) 779 780 { 780 781 struct usbnet *dev = netdev_priv(net); 781 782 struct driver_info *info = dev->driver_info; 782 - int retval; 783 + int retval, pm; 783 784 784 785 clear_bit(EVENT_DEV_OPEN, &dev->flags); 785 786 netif_stop_queue (net); ··· 788 791 net->stats.rx_packets, net->stats.tx_packets, 789 792 net->stats.rx_errors, net->stats.tx_errors); 790 793 794 + /* to not race resume */ 795 + pm = usb_autopm_get_interface(dev->intf); 791 796 /* allow minidriver to stop correctly (wireless devices to turn off 792 797 * radio etc) */ 793 798 if (info->stop) { ··· 816 817 dev->flags = 0; 817 818 del_timer_sync (&dev->delay); 818 819 tasklet_kill (&dev->bh); 820 + if (!pm) 821 + usb_autopm_put_interface(dev->intf); 822 + 819 823 if (info->manage_power && 820 824 !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags)) 821 825 info->manage_power(dev, 0); ··· 1439 1437 /* restart RX again after disabling due to high error rate */ 1440 1438 clear_bit(EVENT_RX_KILL, &dev->flags); 1441 1439 1442 - // waiting for all pending urbs to complete? 1443 - if (dev->wait) { 1444 - if ((dev->txq.qlen + dev->rxq.qlen + dev->done.qlen) == 0) { 1445 - wake_up (dev->wait); 1446 - } 1440 + /* waiting for all pending urbs to complete? 1441 + * only then can we forgo submitting anew 1442 + */ 1443 + if (waitqueue_active(&dev->wait)) { 1444 + if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0) 1445 + wake_up_all(&dev->wait); 1447 1446 1448 1447 // or are we maybe short a few urbs? 1449 1448 } else if (netif_running (dev->net) && ··· 1583 1580 dev->driver_name = name; 1584 1581 dev->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV 1585 1582 | NETIF_MSG_PROBE | NETIF_MSG_LINK); 1583 + init_waitqueue_head(&dev->wait); 1586 1584 skb_queue_head_init (&dev->rxq); 1587 1585 skb_queue_head_init (&dev->txq); 1588 1586 skb_queue_head_init (&dev->done); ··· 1795 1791 spin_unlock_irq(&dev->txq.lock); 1796 1792 1797 1793 if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { 1798 - /* handle remote wakeup ASAP */ 1799 - if (!dev->wait && 1800 - netif_device_present(dev->net) && 1794 + /* handle remote wakeup ASAP 1795 + * we cannot race against stop 1796 + */ 1797 + if (netif_device_present(dev->net) && 1801 1798 !timer_pending(&dev->delay) && 1802 1799 !test_bit(EVENT_RX_HALT, &dev->flags)) 1803 1800 rx_alloc_submit(dev, GFP_NOIO);
+4 -1
drivers/net/veth.c
··· 286 286 dev->features |= NETIF_F_LLTX; 287 287 dev->features |= VETH_FEATURES; 288 288 dev->vlan_features = dev->features & 289 - ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); 289 + ~(NETIF_F_HW_VLAN_CTAG_TX | 290 + NETIF_F_HW_VLAN_STAG_TX | 291 + NETIF_F_HW_VLAN_CTAG_RX | 292 + NETIF_F_HW_VLAN_STAG_RX); 290 293 dev->destructor = veth_dev_free; 291 294 292 295 dev->hw_features = VETH_FEATURES;
+3 -3
drivers/net/virtio_net.c
··· 671 671 if (err) 672 672 break; 673 673 } while (rq->vq->num_free); 674 - if (unlikely(!virtqueue_kick(rq->vq))) 675 - return false; 674 + virtqueue_kick(rq->vq); 676 675 return !oom; 677 676 } 678 677 ··· 876 877 err = xmit_skb(sq, skb); 877 878 878 879 /* This should not happen! */ 879 - if (unlikely(err) || unlikely(!virtqueue_kick(sq->vq))) { 880 + if (unlikely(err)) { 880 881 dev->stats.tx_fifo_errors++; 881 882 if (net_ratelimit()) 882 883 dev_warn(&dev->dev, ··· 885 886 kfree_skb(skb); 886 887 return NETDEV_TX_OK; 887 888 } 889 + virtqueue_kick(sq->vq); 888 890 889 891 /* Don't wait up for transmitted skbs to be freed. */ 890 892 skb_orphan(skb);
+19 -1
drivers/vhost/net.c
··· 505 505 r = -ENOBUFS; 506 506 goto err; 507 507 } 508 - d = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, 508 + r = vhost_get_vq_desc(vq->dev, vq, vq->iov + seg, 509 509 ARRAY_SIZE(vq->iov) - seg, &out, 510 510 &in, log, log_num); 511 + if (unlikely(r < 0)) 512 + goto err; 513 + 514 + d = r; 511 515 if (d == vq->num) { 512 516 r = 0; 513 517 goto err; ··· 536 532 *iovcount = seg; 537 533 if (unlikely(log)) 538 534 *log_num = nlogs; 535 + 536 + /* Detect overrun */ 537 + if (unlikely(datalen > 0)) { 538 + r = UIO_MAXIOV + 1; 539 + goto err; 540 + } 539 541 return headcount; 540 542 err: 541 543 vhost_discard_vq_desc(vq, headcount); ··· 597 587 /* On error, stop handling until the next kick. */ 598 588 if (unlikely(headcount < 0)) 599 589 break; 590 + /* On overrun, truncate and discard */ 591 + if (unlikely(headcount > UIO_MAXIOV)) { 592 + msg.msg_iovlen = 1; 593 + err = sock->ops->recvmsg(NULL, sock, &msg, 594 + 1, MSG_DONTWAIT | MSG_TRUNC); 595 + pr_debug("Discarded rx packet: len %zd\n", sock_len); 596 + continue; 597 + } 600 598 /* OK, now we need to know about added descriptors. */ 601 599 if (!headcount) { 602 600 if (unlikely(vhost_enable_notify(&net->dev, vq))) {
+7
include/linux/netdev_features.h
··· 163 163 /* changeable features with no special hardware requirements */ 164 164 #define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO) 165 165 166 + #define NETIF_F_VLAN_FEATURES (NETIF_F_HW_VLAN_CTAG_FILTER | \ 167 + NETIF_F_HW_VLAN_CTAG_RX | \ 168 + NETIF_F_HW_VLAN_CTAG_TX | \ 169 + NETIF_F_HW_VLAN_STAG_FILTER | \ 170 + NETIF_F_HW_VLAN_STAG_RX | \ 171 + NETIF_F_HW_VLAN_STAG_TX) 172 + 166 173 #endif /* _LINUX_NETDEV_FEATURES_H */
+1 -1
include/linux/netdevice.h
··· 3014 3014 { 3015 3015 return __skb_gso_segment(skb, features, true); 3016 3016 } 3017 - __be16 skb_network_protocol(struct sk_buff *skb); 3017 + __be16 skb_network_protocol(struct sk_buff *skb, int *depth); 3018 3018 3019 3019 static inline bool can_checksum_protocol(netdev_features_t features, 3020 3020 __be16 protocol)
+2 -2
include/linux/skbuff.h
··· 2451 2451 unsigned int flags); 2452 2452 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 2453 2453 unsigned int skb_zerocopy_headlen(const struct sk_buff *from); 2454 - void skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, 2455 - int len, int hlen); 2454 + int skb_zerocopy(struct sk_buff *to, struct sk_buff *from, 2455 + int len, int hlen); 2456 2456 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len); 2457 2457 int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); 2458 2458 void skb_scrub_packet(struct sk_buff *skb, bool xnet);
+1 -1
include/linux/usb/usbnet.h
··· 30 30 struct driver_info *driver_info; 31 31 const char *driver_name; 32 32 void *driver_priv; 33 - wait_queue_head_t *wait; 33 + wait_queue_head_t wait; 34 34 struct mutex phy_mutex; 35 35 unsigned char suspend_count; 36 36 unsigned char pkt_cnt, pkt_err;
+3 -1
include/net/if_inet6.h
··· 31 31 #define IF_PREFIX_AUTOCONF 0x02 32 32 33 33 enum { 34 + INET6_IFADDR_STATE_PREDAD, 34 35 INET6_IFADDR_STATE_DAD, 35 36 INET6_IFADDR_STATE_POSTDAD, 37 + INET6_IFADDR_STATE_ERRDAD, 36 38 INET6_IFADDR_STATE_UP, 37 39 INET6_IFADDR_STATE_DEAD, 38 40 }; ··· 60 58 unsigned long cstamp; /* created timestamp */ 61 59 unsigned long tstamp; /* updated timestamp */ 62 60 63 - struct timer_list dad_timer; 61 + struct delayed_work dad_work; 64 62 65 63 struct inet6_dev *idev; 66 64 struct rt6_info *rt;
+12 -1
lib/random32.c
··· 244 244 static bool latch = false; 245 245 static DEFINE_SPINLOCK(lock); 246 246 247 + /* Asking for random bytes might result in bytes getting 248 + * moved into the nonblocking pool and thus marking it 249 + * as initialized. In this case we would double back into 250 + * this function and attempt to do a late reseed. 251 + * Ignore the pointless attempt to reseed again if we're 252 + * already waiting for bytes when the nonblocking pool 253 + * got initialized. 254 + */ 255 + 247 256 /* only allow initial seeding (late == false) once */ 248 - spin_lock_irqsave(&lock, flags); 257 + if (!spin_trylock_irqsave(&lock, flags)) 258 + return; 259 + 249 260 if (latch && !late) 250 261 goto out; 251 262 latch = true;
+3 -1
net/8021q/vlan.c
··· 307 307 static void vlan_transfer_features(struct net_device *dev, 308 308 struct net_device *vlandev) 309 309 { 310 + struct vlan_dev_priv *vlan = vlan_dev_priv(vlandev); 311 + 310 312 vlandev->gso_max_size = dev->gso_max_size; 311 313 312 - if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) 314 + if (vlan_hw_offload_capable(dev->features, vlan->vlan_proto)) 313 315 vlandev->hard_header_len = dev->hard_header_len; 314 316 else 315 317 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
+5 -1
net/8021q/vlan_dev.c
··· 578 578 579 579 dev->features |= real_dev->vlan_features | NETIF_F_LLTX; 580 580 dev->gso_max_size = real_dev->gso_max_size; 581 + if (dev->features & NETIF_F_VLAN_FEATURES) 582 + netdev_warn(real_dev, "VLAN features are set incorrectly. Q-in-Q configurations may not work correctly.\n"); 583 + 581 584 582 585 /* ipv6 shared card related stuff */ 583 586 dev->dev_id = real_dev->dev_id; ··· 595 592 #endif 596 593 597 594 dev->needed_headroom = real_dev->needed_headroom; 598 - if (real_dev->features & NETIF_F_HW_VLAN_CTAG_TX) { 595 + if (vlan_hw_offload_capable(real_dev->features, 596 + vlan_dev_priv(dev)->vlan_proto)) { 599 597 dev->header_ops = &vlan_passthru_header_ops; 600 598 dev->hard_header_len = real_dev->hard_header_len; 601 599 } else {
+3 -3
net/bridge/br_device.c
··· 49 49 brstats->tx_bytes += skb->len; 50 50 u64_stats_update_end(&brstats->syncp); 51 51 52 - if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid)) 53 - goto out; 54 - 55 52 BR_INPUT_SKB_CB(skb)->brdev = dev; 56 53 57 54 skb_reset_mac_header(skb); 58 55 skb_pull(skb, ETH_HLEN); 56 + 57 + if (!br_allowed_ingress(br, br_get_vlan_info(br), skb, &vid)) 58 + goto out; 59 59 60 60 if (is_broadcast_ether_addr(dest)) 61 61 br_flood_deliver(br, skb, false);
+6 -5
net/bridge/br_input.c
··· 29 29 struct net_device *indev, *brdev = BR_INPUT_SKB_CB(skb)->brdev; 30 30 struct net_bridge *br = netdev_priv(brdev); 31 31 struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats); 32 + struct net_port_vlans *pv; 32 33 33 34 u64_stats_update_begin(&brstats->syncp); 34 35 brstats->rx_packets++; ··· 40 39 * packet is allowed except in promisc modue when someone 41 40 * may be running packet capture. 42 41 */ 42 + pv = br_get_vlan_info(br); 43 43 if (!(brdev->flags & IFF_PROMISC) && 44 - !br_allowed_egress(br, br_get_vlan_info(br), skb)) { 44 + !br_allowed_egress(br, pv, skb)) { 45 45 kfree_skb(skb); 46 46 return NET_RX_DROP; 47 47 } 48 48 49 - skb = br_handle_vlan(br, br_get_vlan_info(br), skb); 50 - if (!skb) 51 - return NET_RX_DROP; 52 - 53 49 indev = skb->dev; 54 50 skb->dev = brdev; 51 + skb = br_handle_vlan(br, pv, skb); 52 + if (!skb) 53 + return NET_RX_DROP; 55 54 56 55 return NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL, 57 56 netif_receive_skb);
+27 -17
net/bridge/br_vlan.c
··· 119 119 kfree_rcu(v, rcu); 120 120 } 121 121 122 - /* Strip the tag from the packet. Will return skb with tci set 0. */ 123 - static struct sk_buff *br_vlan_untag(struct sk_buff *skb) 124 - { 125 - if (skb->protocol != htons(ETH_P_8021Q)) { 126 - skb->vlan_tci = 0; 127 - return skb; 128 - } 129 - 130 - skb->vlan_tci = 0; 131 - skb = vlan_untag(skb); 132 - if (skb) 133 - skb->vlan_tci = 0; 134 - 135 - return skb; 136 - } 137 - 138 122 struct sk_buff *br_handle_vlan(struct net_bridge *br, 139 123 const struct net_port_vlans *pv, 140 124 struct sk_buff *skb) ··· 128 144 if (!br->vlan_enabled) 129 145 goto out; 130 146 147 + /* Vlan filter table must be configured at this point. The 148 + * only exception is the bridge is set in promisc mode and the 149 + * packet is destined for the bridge device. In this case 150 + * pass the packet as is. 151 + */ 152 + if (!pv) { 153 + if ((br->dev->flags & IFF_PROMISC) && skb->dev == br->dev) { 154 + goto out; 155 + } else { 156 + kfree_skb(skb); 157 + return NULL; 158 + } 159 + } 160 + 131 161 /* At this point, we know that the frame was filtered and contains 132 162 * a valid vlan id. If the vlan id is set in the untagged bitmap, 133 163 * send untagged; otherwise, send tagged. 134 164 */ 135 165 br_vlan_get_tag(skb, &vid); 136 166 if (test_bit(vid, pv->untagged_bitmap)) 137 - skb = br_vlan_untag(skb); 167 + skb->vlan_tci = 0; 138 168 139 169 out: 140 170 return skb; ··· 171 173 */ 172 174 if (!v) 173 175 return false; 176 + 177 + /* If vlan tx offload is disabled on bridge device and frame was 178 + * sent from vlan device on the bridge device, it does not have 179 + * HW accelerated vlan tag. 180 + */ 181 + if (unlikely(!vlan_tx_tag_present(skb) && 182 + (skb->protocol == htons(ETH_P_8021Q) || 183 + skb->protocol == htons(ETH_P_8021AD)))) { 184 + skb = vlan_untag(skb); 185 + if (unlikely(!skb)) 186 + return false; 187 + } 174 188 175 189 err = br_vlan_get_tag(skb, vid); 176 190 if (!*vid) {
+9 -4
net/core/dev.c
··· 2286 2286 } 2287 2287 EXPORT_SYMBOL(skb_checksum_help); 2288 2288 2289 - __be16 skb_network_protocol(struct sk_buff *skb) 2289 + __be16 skb_network_protocol(struct sk_buff *skb, int *depth) 2290 2290 { 2291 2291 __be16 type = skb->protocol; 2292 2292 int vlan_depth = ETH_HLEN; ··· 2313 2313 vlan_depth += VLAN_HLEN; 2314 2314 } 2315 2315 2316 + *depth = vlan_depth; 2317 + 2316 2318 return type; 2317 2319 } 2318 2320 ··· 2328 2326 { 2329 2327 struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); 2330 2328 struct packet_offload *ptype; 2331 - __be16 type = skb_network_protocol(skb); 2329 + int vlan_depth = skb->mac_len; 2330 + __be16 type = skb_network_protocol(skb, &vlan_depth); 2332 2331 2333 2332 if (unlikely(!type)) 2334 2333 return ERR_PTR(-EINVAL); 2335 2334 2336 - __skb_pull(skb, skb->mac_len); 2335 + __skb_pull(skb, vlan_depth); 2337 2336 2338 2337 rcu_read_lock(); 2339 2338 list_for_each_entry_rcu(ptype, &offload_base, list) { ··· 2501 2498 const struct net_device *dev, 2502 2499 netdev_features_t features) 2503 2500 { 2501 + int tmp; 2502 + 2504 2503 if (skb->ip_summed != CHECKSUM_NONE && 2505 - !can_checksum_protocol(features, skb_network_protocol(skb))) { 2504 + !can_checksum_protocol(features, skb_network_protocol(skb, &tmp))) { 2506 2505 features &= ~NETIF_F_ALL_CSUM; 2507 2506 } else if (illegal_highdma(dev, skb)) { 2508 2507 features &= ~NETIF_F_SG;
+22 -8
net/core/skbuff.c
··· 2127 2127 * 2128 2128 * The `hlen` as calculated by skb_zerocopy_headlen() specifies the 2129 2129 * headroom in the `to` buffer. 2130 + * 2131 + * Return value: 2132 + * 0: everything is OK 2133 + * -ENOMEM: couldn't orphan frags of @from due to lack of memory 2134 + * -EFAULT: skb_copy_bits() found some problem with skb geometry 2130 2135 */ 2131 - void 2132 - skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) 2136 + int 2137 + skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen) 2133 2138 { 2134 2139 int i, j = 0; 2135 2140 int plen = 0; /* length of skb->head fragment */ 2141 + int ret; 2136 2142 struct page *page; 2137 2143 unsigned int offset; 2138 2144 2139 2145 BUG_ON(!from->head_frag && !hlen); 2140 2146 2141 2147 /* dont bother with small payloads */ 2142 - if (len <= skb_tailroom(to)) { 2143 - skb_copy_bits(from, 0, skb_put(to, len), len); 2144 - return; 2145 - } 2148 + if (len <= skb_tailroom(to)) 2149 + return skb_copy_bits(from, 0, skb_put(to, len), len); 2146 2150 2147 2151 if (hlen) { 2148 - skb_copy_bits(from, 0, skb_put(to, hlen), hlen); 2152 + ret = skb_copy_bits(from, 0, skb_put(to, hlen), hlen); 2153 + if (unlikely(ret)) 2154 + return ret; 2149 2155 len -= hlen; 2150 2156 } else { 2151 2157 plen = min_t(int, skb_headlen(from), len); ··· 2169 2163 to->len += len + plen; 2170 2164 to->data_len += len + plen; 2171 2165 2166 + if (unlikely(skb_orphan_frags(from, GFP_ATOMIC))) { 2167 + skb_tx_error(from); 2168 + return -ENOMEM; 2169 + } 2170 + 2172 2171 for (i = 0; i < skb_shinfo(from)->nr_frags; i++) { 2173 2172 if (!len) 2174 2173 break; ··· 2184 2173 j++; 2185 2174 } 2186 2175 skb_shinfo(to)->nr_frags = j; 2176 + 2177 + return 0; 2187 2178 } 2188 2179 EXPORT_SYMBOL_GPL(skb_zerocopy); 2189 2180 ··· 2879 2866 int err = -ENOMEM; 2880 2867 int i = 0; 2881 2868 int pos; 2869 + int dummy; 2882 2870 2883 - proto = skb_network_protocol(head_skb); 2871 + proto = skb_network_protocol(head_skb, &dummy); 2884 2872 if (unlikely(!proto)) 2885 2873 return ERR_PTR(-EINVAL); 2886 2874
+8
net/ipv4/gre_demux.c
··· 182 182 int i; 183 183 bool csum_err = false; 184 184 185 + #ifdef CONFIG_NET_IPGRE_BROADCAST 186 + if (ipv4_is_multicast(ip_hdr(skb)->daddr)) { 187 + /* Looped back packet, drop it! */ 188 + if (rt_is_output_route(skb_rtable(skb))) 189 + goto drop; 190 + } 191 + #endif 192 + 185 193 if (parse_gre_header(skb, &tpi, &csum_err) < 0) 186 194 goto drop; 187 195
-3
net/ipv4/ip_tunnel.c
··· 416 416 417 417 #ifdef CONFIG_NET_IPGRE_BROADCAST 418 418 if (ipv4_is_multicast(iph->daddr)) { 419 - /* Looped back packet, drop it! */ 420 - if (rt_is_output_route(skb_rtable(skb))) 421 - goto drop; 422 419 tunnel->dev->stats.multicast++; 423 420 skb->pkt_type = PACKET_BROADCAST; 424 421 }
+1
net/ipv4/ip_tunnel_core.c
··· 108 108 nf_reset(skb); 109 109 secpath_reset(skb); 110 110 skb_clear_hash_if_not_l4(skb); 111 + skb_dst_drop(skb); 111 112 skb->vlan_tci = 0; 112 113 skb_set_queue_mapping(skb, 0); 113 114 skb->pkt_type = PACKET_HOST;
+1 -1
net/ipv4/tcp_ipv4.c
··· 2628 2628 { 2629 2629 __be32 dest, src; 2630 2630 __u16 destp, srcp; 2631 - long delta = tw->tw_ttd - jiffies; 2631 + s32 delta = tw->tw_ttd - inet_tw_time_stamp(); 2632 2632 2633 2633 dest = tw->tw_daddr; 2634 2634 src = tw->tw_rcv_saddr;
+142 -51
net/ipv6/addrconf.c
··· 133 133 static struct hlist_head inet6_addr_lst[IN6_ADDR_HSIZE]; 134 134 static DEFINE_SPINLOCK(addrconf_hash_lock); 135 135 136 - static void addrconf_verify(unsigned long); 136 + static void addrconf_verify(void); 137 + static void addrconf_verify_rtnl(void); 138 + static void addrconf_verify_work(struct work_struct *); 137 139 138 - static DEFINE_TIMER(addr_chk_timer, addrconf_verify, 0, 0); 139 - static DEFINE_SPINLOCK(addrconf_verify_lock); 140 + static struct workqueue_struct *addrconf_wq; 141 + static DECLARE_DELAYED_WORK(addr_chk_work, addrconf_verify_work); 140 142 141 143 static void addrconf_join_anycast(struct inet6_ifaddr *ifp); 142 144 static void addrconf_leave_anycast(struct inet6_ifaddr *ifp); ··· 153 151 u32 flags, u32 noflags); 154 152 155 153 static void addrconf_dad_start(struct inet6_ifaddr *ifp); 156 - static void addrconf_dad_timer(unsigned long data); 154 + static void addrconf_dad_work(struct work_struct *w); 157 155 static void addrconf_dad_completed(struct inet6_ifaddr *ifp); 158 156 static void addrconf_dad_run(struct inet6_dev *idev); 159 157 static void addrconf_rs_timer(unsigned long data); ··· 249 247 __in6_dev_put(idev); 250 248 } 251 249 252 - static void addrconf_del_dad_timer(struct inet6_ifaddr *ifp) 250 + static void addrconf_del_dad_work(struct inet6_ifaddr *ifp) 253 251 { 254 - if (del_timer(&ifp->dad_timer)) 252 + if (cancel_delayed_work(&ifp->dad_work)) 255 253 __in6_ifa_put(ifp); 256 254 } 257 255 ··· 263 261 mod_timer(&idev->rs_timer, jiffies + when); 264 262 } 265 263 266 - static void addrconf_mod_dad_timer(struct inet6_ifaddr *ifp, 267 - unsigned long when) 264 + static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp, 265 + unsigned long delay) 268 266 { 269 - if (!timer_pending(&ifp->dad_timer)) 267 + if (!delayed_work_pending(&ifp->dad_work)) 270 268 in6_ifa_hold(ifp); 271 - mod_timer(&ifp->dad_timer, jiffies + when); 269 + mod_delayed_work(addrconf_wq, &ifp->dad_work, delay); 272 270 } 273 271 274 272 static int snmp6_alloc_dev(struct inet6_dev *idev) ··· 753 751 754 752 in6_dev_put(ifp->idev); 755 753 756 - if (del_timer(&ifp->dad_timer)) 757 - pr_notice("Timer is still running, when freeing ifa=%p\n", ifp); 754 + if (cancel_delayed_work(&ifp->dad_work)) 755 + pr_notice("delayed DAD work was pending while freeing ifa=%p\n", 756 + ifp); 758 757 759 758 if (ifp->state != INET6_IFADDR_STATE_DEAD) { 760 759 pr_warn("Freeing alive inet6 address %p\n", ifp); ··· 852 849 853 850 spin_lock_init(&ifa->lock); 854 851 spin_lock_init(&ifa->state_lock); 855 - setup_timer(&ifa->dad_timer, addrconf_dad_timer, 856 - (unsigned long)ifa); 852 + INIT_DELAYED_WORK(&ifa->dad_work, addrconf_dad_work); 857 853 INIT_HLIST_NODE(&ifa->addr_lst); 858 854 ifa->scope = scope; 859 855 ifa->prefix_len = pfxlen; ··· 992 990 enum cleanup_prefix_rt_t action = CLEANUP_PREFIX_RT_NOP; 993 991 unsigned long expires; 994 992 993 + ASSERT_RTNL(); 994 + 995 995 spin_lock_bh(&ifp->state_lock); 996 996 state = ifp->state; 997 997 ifp->state = INET6_IFADDR_STATE_DEAD; ··· 1025 1021 1026 1022 write_unlock_bh(&ifp->idev->lock); 1027 1023 1028 - addrconf_del_dad_timer(ifp); 1024 + addrconf_del_dad_work(ifp); 1029 1025 1030 1026 ipv6_ifa_notify(RTM_DELADDR, ifp); 1031 1027 ··· 1608 1604 { 1609 1605 if (ifp->flags&IFA_F_PERMANENT) { 1610 1606 spin_lock_bh(&ifp->lock); 1611 - addrconf_del_dad_timer(ifp); 1607 + addrconf_del_dad_work(ifp); 1612 1608 ifp->flags |= IFA_F_TENTATIVE; 1613 1609 if (dad_failed) 1614 1610 ifp->flags |= IFA_F_DADFAILED; ··· 1629 1625 spin_unlock_bh(&ifp->lock); 1630 1626 } 1631 1627 ipv6_del_addr(ifp); 1632 - } else 1628 + } else { 1633 1629 ipv6_del_addr(ifp); 1630 + } 1634 1631 } 1635 1632 1636 1633 static int addrconf_dad_end(struct inet6_ifaddr *ifp) 1637 1634 { 1638 1635 int err = -ENOENT; 1639 1636 1640 - spin_lock(&ifp->state_lock); 1637 + spin_lock_bh(&ifp->state_lock); 1641 1638 if (ifp->state == INET6_IFADDR_STATE_DAD) { 1642 1639 ifp->state = INET6_IFADDR_STATE_POSTDAD; 1643 1640 err = 0; 1644 1641 } 1645 - spin_unlock(&ifp->state_lock); 1642 + spin_unlock_bh(&ifp->state_lock); 1646 1643 1647 1644 return err; 1648 1645 } ··· 1676 1671 } 1677 1672 } 1678 1673 1679 - addrconf_dad_stop(ifp, 1); 1674 + spin_lock_bh(&ifp->state_lock); 1675 + /* transition from _POSTDAD to _ERRDAD */ 1676 + ifp->state = INET6_IFADDR_STATE_ERRDAD; 1677 + spin_unlock_bh(&ifp->state_lock); 1678 + 1679 + addrconf_mod_dad_work(ifp, 0); 1680 1680 } 1681 1681 1682 1682 /* Join to solicited addr multicast group. */ ··· 1689 1679 void addrconf_join_solict(struct net_device *dev, const struct in6_addr *addr) 1690 1680 { 1691 1681 struct in6_addr maddr; 1682 + 1683 + ASSERT_RTNL(); 1692 1684 1693 1685 if (dev->flags&(IFF_LOOPBACK|IFF_NOARP)) 1694 1686 return; ··· 1703 1691 { 1704 1692 struct in6_addr maddr; 1705 1693 1694 + ASSERT_RTNL(); 1695 + 1706 1696 if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP)) 1707 1697 return; 1708 1698 ··· 1715 1701 static void addrconf_join_anycast(struct inet6_ifaddr *ifp) 1716 1702 { 1717 1703 struct in6_addr addr; 1704 + 1705 + ASSERT_RTNL(); 1706 + 1718 1707 if (ifp->prefix_len >= 127) /* RFC 6164 */ 1719 1708 return; 1720 1709 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); ··· 1729 1712 static void addrconf_leave_anycast(struct inet6_ifaddr *ifp) 1730 1713 { 1731 1714 struct in6_addr addr; 1715 + 1716 + ASSERT_RTNL(); 1717 + 1732 1718 if (ifp->prefix_len >= 127) /* RFC 6164 */ 1733 1719 return; 1734 1720 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len); ··· 2291 2271 return; 2292 2272 } 2293 2273 2294 - ifp->flags |= IFA_F_MANAGETEMPADDR; 2295 2274 update_lft = 0; 2296 2275 create = 1; 2276 + spin_lock_bh(&ifp->lock); 2277 + ifp->flags |= IFA_F_MANAGETEMPADDR; 2297 2278 ifp->cstamp = jiffies; 2298 2279 ifp->tokenized = tokenized; 2280 + spin_unlock_bh(&ifp->lock); 2299 2281 addrconf_dad_start(ifp); 2300 2282 } 2301 2283 ··· 2348 2326 create, now); 2349 2327 2350 2328 in6_ifa_put(ifp); 2351 - addrconf_verify(0); 2329 + addrconf_verify(); 2352 2330 } 2353 2331 } 2354 2332 inet6_prefix_notify(RTM_NEWPREFIX, in6_dev, pinfo); ··· 2497 2475 manage_tempaddrs(idev, ifp, valid_lft, prefered_lft, 2498 2476 true, jiffies); 2499 2477 in6_ifa_put(ifp); 2500 - addrconf_verify(0); 2478 + addrconf_verify_rtnl(); 2501 2479 return 0; 2502 2480 } 2503 2481 ··· 3033 3011 hlist_for_each_entry_rcu(ifa, h, addr_lst) { 3034 3012 if (ifa->idev == idev) { 3035 3013 hlist_del_init_rcu(&ifa->addr_lst); 3036 - addrconf_del_dad_timer(ifa); 3014 + addrconf_del_dad_work(ifa); 3037 3015 goto restart; 3038 3016 } 3039 3017 } ··· 3071 3049 while (!list_empty(&idev->addr_list)) { 3072 3050 ifa = list_first_entry(&idev->addr_list, 3073 3051 struct inet6_ifaddr, if_list); 3074 - addrconf_del_dad_timer(ifa); 3052 + addrconf_del_dad_work(ifa); 3075 3053 3076 3054 list_del(&ifa->if_list); 3077 3055 ··· 3170 3148 rand_num = prandom_u32() % (idev->cnf.rtr_solicit_delay ? : 1); 3171 3149 3172 3150 ifp->dad_probes = idev->cnf.dad_transmits; 3173 - addrconf_mod_dad_timer(ifp, rand_num); 3151 + addrconf_mod_dad_work(ifp, rand_num); 3174 3152 } 3175 3153 3176 - static void addrconf_dad_start(struct inet6_ifaddr *ifp) 3154 + static void addrconf_dad_begin(struct inet6_ifaddr *ifp) 3177 3155 { 3178 3156 struct inet6_dev *idev = ifp->idev; 3179 3157 struct net_device *dev = idev->dev; ··· 3225 3203 read_unlock_bh(&idev->lock); 3226 3204 } 3227 3205 3228 - static void addrconf_dad_timer(unsigned long data) 3206 + static void addrconf_dad_start(struct inet6_ifaddr *ifp) 3229 3207 { 3230 - struct inet6_ifaddr *ifp = (struct inet6_ifaddr *) data; 3208 + bool begin_dad = false; 3209 + 3210 + spin_lock_bh(&ifp->state_lock); 3211 + if (ifp->state != INET6_IFADDR_STATE_DEAD) { 3212 + ifp->state = INET6_IFADDR_STATE_PREDAD; 3213 + begin_dad = true; 3214 + } 3215 + spin_unlock_bh(&ifp->state_lock); 3216 + 3217 + if (begin_dad) 3218 + addrconf_mod_dad_work(ifp, 0); 3219 + } 3220 + 3221 + static void addrconf_dad_work(struct work_struct *w) 3222 + { 3223 + struct inet6_ifaddr *ifp = container_of(to_delayed_work(w), 3224 + struct inet6_ifaddr, 3225 + dad_work); 3231 3226 struct inet6_dev *idev = ifp->idev; 3232 3227 struct in6_addr mcaddr; 3228 + 3229 + enum { 3230 + DAD_PROCESS, 3231 + DAD_BEGIN, 3232 + DAD_ABORT, 3233 + } action = DAD_PROCESS; 3234 + 3235 + rtnl_lock(); 3236 + 3237 + spin_lock_bh(&ifp->state_lock); 3238 + if (ifp->state == INET6_IFADDR_STATE_PREDAD) { 3239 + action = DAD_BEGIN; 3240 + ifp->state = INET6_IFADDR_STATE_DAD; 3241 + } else if (ifp->state == INET6_IFADDR_STATE_ERRDAD) { 3242 + action = DAD_ABORT; 3243 + ifp->state = INET6_IFADDR_STATE_POSTDAD; 3244 + } 3245 + spin_unlock_bh(&ifp->state_lock); 3246 + 3247 + if (action == DAD_BEGIN) { 3248 + addrconf_dad_begin(ifp); 3249 + goto out; 3250 + } else if (action == DAD_ABORT) { 3251 + addrconf_dad_stop(ifp, 1); 3252 + goto out; 3253 + } 3233 3254 3234 3255 if (!ifp->dad_probes && addrconf_dad_end(ifp)) 3235 3256 goto out; 3236 3257 3237 - write_lock(&idev->lock); 3258 + write_lock_bh(&idev->lock); 3238 3259 if (idev->dead || !(idev->if_flags & IF_READY)) { 3239 - write_unlock(&idev->lock); 3260 + write_unlock_bh(&idev->lock); 3240 3261 goto out; 3241 3262 } 3242 3263 3243 3264 spin_lock(&ifp->lock); 3244 3265 if (ifp->state == INET6_IFADDR_STATE_DEAD) { 3245 3266 spin_unlock(&ifp->lock); 3246 - write_unlock(&idev->lock); 3267 + write_unlock_bh(&idev->lock); 3247 3268 goto out; 3248 3269 } 3249 3270 ··· 3297 3232 3298 3233 ifp->flags &= ~(IFA_F_TENTATIVE|IFA_F_OPTIMISTIC|IFA_F_DADFAILED); 3299 3234 spin_unlock(&ifp->lock); 3300 - write_unlock(&idev->lock); 3235 + write_unlock_bh(&idev->lock); 3301 3236 3302 3237 addrconf_dad_completed(ifp); 3303 3238 ··· 3305 3240 } 3306 3241 3307 3242 ifp->dad_probes--; 3308 - addrconf_mod_dad_timer(ifp, 3309 - NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME)); 3243 + addrconf_mod_dad_work(ifp, 3244 + NEIGH_VAR(ifp->idev->nd_parms, RETRANS_TIME)); 3310 3245 spin_unlock(&ifp->lock); 3311 - write_unlock(&idev->lock); 3246 + write_unlock_bh(&idev->lock); 3312 3247 3313 3248 /* send a neighbour solicitation for our addr */ 3314 3249 addrconf_addr_solict_mult(&ifp->addr, &mcaddr); 3315 3250 ndisc_send_ns(ifp->idev->dev, NULL, &ifp->addr, &mcaddr, &in6addr_any); 3316 3251 out: 3317 3252 in6_ifa_put(ifp); 3253 + rtnl_unlock(); 3318 3254 } 3319 3255 3320 3256 /* ifp->idev must be at least read locked */ ··· 3342 3276 struct in6_addr lladdr; 3343 3277 bool send_rs, send_mld; 3344 3278 3345 - addrconf_del_dad_timer(ifp); 3279 + addrconf_del_dad_work(ifp); 3346 3280 3347 3281 /* 3348 3282 * Configure the address for reception. Now it is valid. ··· 3583 3517 * Periodic address status verification 3584 3518 */ 3585 3519 3586 - static void addrconf_verify(unsigned long foo) 3520 + static void addrconf_verify_rtnl(void) 3587 3521 { 3588 3522 unsigned long now, next, next_sec, next_sched; 3589 3523 struct inet6_ifaddr *ifp; 3590 3524 int i; 3591 3525 3526 + ASSERT_RTNL(); 3527 + 3592 3528 rcu_read_lock_bh(); 3593 - spin_lock(&addrconf_verify_lock); 3594 3529 now = jiffies; 3595 3530 next = round_jiffies_up(now + ADDR_CHECK_FREQUENCY); 3596 3531 3597 - del_timer(&addr_chk_timer); 3532 + cancel_delayed_work(&addr_chk_work); 3598 3533 3599 3534 for (i = 0; i < IN6_ADDR_HSIZE; i++) { 3600 3535 restart: 3601 - hlist_for_each_entry_rcu_bh(ifp, 3602 - &inet6_addr_lst[i], addr_lst) { 3536 + hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[i], addr_lst) { 3603 3537 unsigned long age; 3604 3538 3605 3539 /* When setting preferred_lft to a value not zero or ··· 3694 3628 3695 3629 ADBG(KERN_DEBUG "now = %lu, schedule = %lu, rounded schedule = %lu => %lu\n", 3696 3630 now, next, next_sec, next_sched); 3697 - 3698 - addr_chk_timer.expires = next_sched; 3699 - add_timer(&addr_chk_timer); 3700 - spin_unlock(&addrconf_verify_lock); 3631 + mod_delayed_work(addrconf_wq, &addr_chk_work, next_sched - now); 3701 3632 rcu_read_unlock_bh(); 3633 + } 3634 + 3635 + static void addrconf_verify_work(struct work_struct *w) 3636 + { 3637 + rtnl_lock(); 3638 + addrconf_verify_rtnl(); 3639 + rtnl_unlock(); 3640 + } 3641 + 3642 + static void addrconf_verify(void) 3643 + { 3644 + mod_delayed_work(addrconf_wq, &addr_chk_work, 0); 3702 3645 } 3703 3646 3704 3647 static struct in6_addr *extract_addr(struct nlattr *addr, struct nlattr *local, ··· 3765 3690 unsigned long timeout; 3766 3691 bool was_managetempaddr; 3767 3692 bool had_prefixroute; 3693 + 3694 + ASSERT_RTNL(); 3768 3695 3769 3696 if (!valid_lft || (prefered_lft > valid_lft)) 3770 3697 return -EINVAL; ··· 3833 3756 !was_managetempaddr, jiffies); 3834 3757 } 3835 3758 3836 - addrconf_verify(0); 3759 + addrconf_verify_rtnl(); 3837 3760 3838 3761 return 0; 3839 3762 } ··· 4463 4386 bool update_rs = false; 4464 4387 struct in6_addr ll_addr; 4465 4388 4389 + ASSERT_RTNL(); 4390 + 4466 4391 if (token == NULL) 4467 4392 return -EINVAL; 4468 4393 if (ipv6_addr_any(token)) ··· 4513 4434 } 4514 4435 4515 4436 write_unlock_bh(&idev->lock); 4516 - addrconf_verify(0); 4437 + addrconf_verify_rtnl(); 4517 4438 return 0; 4518 4439 } 4519 4440 ··· 4714 4635 static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 4715 4636 { 4716 4637 struct net *net = dev_net(ifp->idev->dev); 4638 + 4639 + if (event) 4640 + ASSERT_RTNL(); 4717 4641 4718 4642 inet6_ifa_notify(event ? : RTM_NEWADDR, ifp); 4719 4643 ··· 5326 5244 if (err < 0) 5327 5245 goto out_addrlabel; 5328 5246 5247 + addrconf_wq = create_workqueue("ipv6_addrconf"); 5248 + if (!addrconf_wq) { 5249 + err = -ENOMEM; 5250 + goto out_nowq; 5251 + } 5252 + 5329 5253 /* The addrconf netdev notifier requires that loopback_dev 5330 5254 * has it's ipv6 private information allocated and setup 5331 5255 * before it can bring up and give link-local addresses ··· 5362 5274 5363 5275 register_netdevice_notifier(&ipv6_dev_notf); 5364 5276 5365 - addrconf_verify(0); 5277 + addrconf_verify(); 5366 5278 5367 5279 rtnl_af_register(&inet6_ops); 5368 5280 ··· 5390 5302 rtnl_af_unregister(&inet6_ops); 5391 5303 unregister_netdevice_notifier(&ipv6_dev_notf); 5392 5304 errlo: 5305 + destroy_workqueue(addrconf_wq); 5306 + out_nowq: 5393 5307 unregister_pernet_subsys(&addrconf_ops); 5394 5308 out_addrlabel: 5395 5309 ipv6_addr_label_cleanup(); ··· 5427 5337 for (i = 0; i < IN6_ADDR_HSIZE; i++) 5428 5338 WARN_ON(!hlist_empty(&inet6_addr_lst[i])); 5429 5339 spin_unlock_bh(&addrconf_hash_lock); 5430 - 5431 - del_timer(&addr_chk_timer); 5340 + cancel_delayed_work(&addr_chk_work); 5432 5341 rtnl_unlock(); 5342 + 5343 + destroy_workqueue(addrconf_wq); 5433 5344 }
+5 -1
net/openvswitch/datapath.c
··· 464 464 } 465 465 nla->nla_len = nla_attr_size(skb->len); 466 466 467 - skb_zerocopy(user_skb, skb, skb->len, hlen); 467 + err = skb_zerocopy(user_skb, skb, skb->len, hlen); 468 + if (err) 469 + goto out; 468 470 469 471 /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */ 470 472 if (!(dp->user_features & OVS_DP_F_UNALIGNED)) { ··· 480 478 481 479 err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid); 482 480 out: 481 + if (err) 482 + skb_tx_error(skb); 483 483 kfree_skb(nskb); 484 484 return err; 485 485 }
+6 -20
net/openvswitch/flow.c
··· 103 103 void ovs_flow_stats_get(struct sw_flow *flow, struct ovs_flow_stats *ovs_stats, 104 104 unsigned long *used, __be16 *tcp_flags) 105 105 { 106 - int cpu, cur_cpu; 106 + int cpu; 107 107 108 108 *used = 0; 109 109 *tcp_flags = 0; 110 110 memset(ovs_stats, 0, sizeof(*ovs_stats)); 111 111 112 + local_bh_disable(); 112 113 if (!flow->stats.is_percpu) { 113 114 stats_read(flow->stats.stat, ovs_stats, used, tcp_flags); 114 115 } else { 115 - cur_cpu = get_cpu(); 116 116 for_each_possible_cpu(cpu) { 117 117 struct flow_stats *stats; 118 118 119 - if (cpu == cur_cpu) 120 - local_bh_disable(); 121 - 122 119 stats = per_cpu_ptr(flow->stats.cpu_stats, cpu); 123 120 stats_read(stats, ovs_stats, used, tcp_flags); 124 - 125 - if (cpu == cur_cpu) 126 - local_bh_enable(); 127 121 } 128 - put_cpu(); 129 122 } 123 + local_bh_enable(); 130 124 } 131 125 132 126 static void stats_reset(struct flow_stats *stats) ··· 135 141 136 142 void ovs_flow_stats_clear(struct sw_flow *flow) 137 143 { 138 - int cpu, cur_cpu; 144 + int cpu; 139 145 146 + local_bh_disable(); 140 147 if (!flow->stats.is_percpu) { 141 148 stats_reset(flow->stats.stat); 142 149 } else { 143 - cur_cpu = get_cpu(); 144 - 145 150 for_each_possible_cpu(cpu) { 146 - 147 - if (cpu == cur_cpu) 148 - local_bh_disable(); 149 - 150 151 stats_reset(per_cpu_ptr(flow->stats.cpu_stats, cpu)); 151 - 152 - if (cpu == cur_cpu) 153 - local_bh_enable(); 154 152 } 155 - put_cpu(); 156 153 } 154 + local_bh_enable(); 157 155 } 158 156 159 157 static int check_header(struct sk_buff *skb, int len)
+12 -5
net/unix/af_unix.c
··· 1787 1787 goto out; 1788 1788 1789 1789 err = mutex_lock_interruptible(&u->readlock); 1790 - if (err) { 1791 - err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); 1790 + if (unlikely(err)) { 1791 + /* recvmsg() in non blocking mode is supposed to return -EAGAIN 1792 + * sk_rcvtimeo is not honored by mutex_lock_interruptible() 1793 + */ 1794 + err = noblock ? -EAGAIN : -ERESTARTSYS; 1792 1795 goto out; 1793 1796 } 1794 1797 ··· 1916 1913 struct unix_sock *u = unix_sk(sk); 1917 1914 DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name); 1918 1915 int copied = 0; 1916 + int noblock = flags & MSG_DONTWAIT; 1919 1917 int check_creds = 0; 1920 1918 int target; 1921 1919 int err = 0; ··· 1932 1928 goto out; 1933 1929 1934 1930 target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); 1935 - timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); 1931 + timeo = sock_rcvtimeo(sk, noblock); 1936 1932 1937 1933 /* Lock the socket to prevent queue disordering 1938 1934 * while sleeps in memcpy_tomsg ··· 1944 1940 } 1945 1941 1946 1942 err = mutex_lock_interruptible(&u->readlock); 1947 - if (err) { 1948 - err = sock_intr_errno(timeo); 1943 + if (unlikely(err)) { 1944 + /* recvmsg() in non blocking mode is supposed to return -EAGAIN 1945 + * sk_rcvtimeo is not honored by mutex_lock_interruptible() 1946 + */ 1947 + err = noblock ? -EAGAIN : -ERESTARTSYS; 1949 1948 goto out; 1950 1949 } 1951 1950