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

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

Conflicts:
drivers/net/ethernet/marvell/mvneta.c

The mvneta.c conflict is a case of overlapping changes,
a conversion to devm_ioremap_resource() vs. a conversion
to netdev_alloc_pcpu_stats.

Signed-off-by: David S. Miller <davem@davemloft.net>

+529 -269
+3 -2
MAINTAINERS
··· 1839 1839 F: include/net/bluetooth/ 1840 1840 1841 1841 BONDING DRIVER 1842 - M: Jay Vosburgh <fubar@us.ibm.com> 1843 - M: Veaceslav Falico <vfalico@redhat.com> 1842 + M: Jay Vosburgh <j.vosburgh@gmail.com> 1843 + M: Veaceslav Falico <vfalico@gmail.com> 1844 1844 M: Andy Gospodarek <andy@greyhouse.net> 1845 1845 L: netdev@vger.kernel.org 1846 1846 W: http://sourceforge.net/projects/bonding/ ··· 6019 6019 F: include/uapi/linux/netdevice.h 6020 6020 F: tools/net/ 6021 6021 F: tools/testing/selftests/net/ 6022 + F: lib/random32.c 6022 6023 6023 6024 NETWORKING [IPv4/IPv6] 6024 6025 M: "David S. Miller" <davem@davemloft.net>
+2 -12
arch/x86/include/asm/pgtable.h
··· 445 445 return a.pte == b.pte; 446 446 } 447 447 448 - static inline int pteval_present(pteval_t pteval) 449 - { 450 - /* 451 - * Yes Linus, _PAGE_PROTNONE == _PAGE_NUMA. Expressing it this 452 - * way clearly states that the intent is that protnone and numa 453 - * hinting ptes are considered present for the purposes of 454 - * pagetable operations like zapping, protection changes, gup etc. 455 - */ 456 - return pteval & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_NUMA); 457 - } 458 - 459 448 static inline int pte_present(pte_t a) 460 449 { 461 - return pteval_present(pte_flags(a)); 450 + return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE | 451 + _PAGE_NUMA); 462 452 } 463 453 464 454 #define pte_accessible pte_accessible
+2 -1
arch/x86/include/asm/topology.h
··· 119 119 120 120 extern const struct cpumask *cpu_coregroup_mask(int cpu); 121 121 122 - #ifdef ENABLE_TOPO_DEFINES 123 122 #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) 124 123 #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) 124 + 125 + #ifdef ENABLE_TOPO_DEFINES 125 126 #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) 126 127 #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) 127 128 #endif
+2 -2
arch/x86/xen/mmu.c
··· 365 365 /* Assume pteval_t is equivalent to all the other *val_t types. */ 366 366 static pteval_t pte_mfn_to_pfn(pteval_t val) 367 367 { 368 - if (pteval_present(val)) { 368 + if (val & _PAGE_PRESENT) { 369 369 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 370 370 unsigned long pfn = mfn_to_pfn(mfn); 371 371 ··· 381 381 382 382 static pteval_t pte_pfn_to_mfn(pteval_t val) 383 383 { 384 - if (pteval_present(val)) { 384 + if (val & _PAGE_PRESENT) { 385 385 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 386 386 pteval_t flags = val & PTE_FLAGS_MASK; 387 387 unsigned long mfn;
+1 -1
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 842 842 dev_priv->gtt.base.clear_range(&dev_priv->gtt.base, 843 843 dev_priv->gtt.base.start / PAGE_SIZE, 844 844 dev_priv->gtt.base.total / PAGE_SIZE, 845 - false); 845 + true); 846 846 } 847 847 848 848 void i915_gem_restore_gtt_mappings(struct drm_device *dev)
+10 -4
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 866 866 struct drm_device *drm_dev = pci_get_drvdata(pdev); 867 867 int ret; 868 868 869 - if (nouveau_runtime_pm == 0) 870 - return -EINVAL; 869 + if (nouveau_runtime_pm == 0) { 870 + pm_runtime_forbid(dev); 871 + return -EBUSY; 872 + } 871 873 872 874 /* are we optimus enabled? */ 873 875 if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { 874 876 DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); 875 - return -EINVAL; 877 + pm_runtime_forbid(dev); 878 + return -EBUSY; 876 879 } 877 880 878 881 nv_debug_level(SILENT); ··· 926 923 struct nouveau_drm *drm = nouveau_drm(drm_dev); 927 924 struct drm_crtc *crtc; 928 925 929 - if (nouveau_runtime_pm == 0) 926 + if (nouveau_runtime_pm == 0) { 927 + pm_runtime_forbid(dev); 930 928 return -EBUSY; 929 + } 931 930 932 931 /* are we optimus enabled? */ 933 932 if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { 934 933 DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); 934 + pm_runtime_forbid(dev); 935 935 return -EBUSY; 936 936 } 937 937
+12 -5
drivers/gpu/drm/radeon/radeon_drv.c
··· 403 403 struct drm_device *drm_dev = pci_get_drvdata(pdev); 404 404 int ret; 405 405 406 - if (radeon_runtime_pm == 0) 407 - return -EINVAL; 406 + if (radeon_runtime_pm == 0) { 407 + pm_runtime_forbid(dev); 408 + return -EBUSY; 409 + } 408 410 409 - if (radeon_runtime_pm == -1 && !radeon_is_px()) 410 - return -EINVAL; 411 + if (radeon_runtime_pm == -1 && !radeon_is_px()) { 412 + pm_runtime_forbid(dev); 413 + return -EBUSY; 414 + } 411 415 412 416 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; 413 417 drm_kms_helper_poll_disable(drm_dev); ··· 460 456 struct drm_device *drm_dev = pci_get_drvdata(pdev); 461 457 struct drm_crtc *crtc; 462 458 463 - if (radeon_runtime_pm == 0) 459 + if (radeon_runtime_pm == 0) { 460 + pm_runtime_forbid(dev); 464 461 return -EBUSY; 462 + } 465 463 466 464 /* are we PX enabled? */ 467 465 if (radeon_runtime_pm == -1 && !radeon_is_px()) { 468 466 DRM_DEBUG_DRIVER("failing to power off - not px\n"); 467 + pm_runtime_forbid(dev); 469 468 return -EBUSY; 470 469 } 471 470
+8 -3
drivers/gpu/drm/udl/udl_gem.c
··· 177 177 if (obj->vmapping) 178 178 udl_gem_vunmap(obj); 179 179 180 - if (gem_obj->import_attach) 180 + if (gem_obj->import_attach) { 181 181 drm_prime_gem_destroy(gem_obj, obj->sg); 182 + put_device(gem_obj->dev->dev); 183 + } 182 184 183 185 if (obj->pages) 184 186 udl_gem_put_pages(obj); ··· 258 256 int ret; 259 257 260 258 /* need to attach */ 259 + get_device(dev->dev); 261 260 attach = dma_buf_attach(dma_buf, dev->dev); 262 - if (IS_ERR(attach)) 261 + if (IS_ERR(attach)) { 262 + put_device(dev->dev); 263 263 return ERR_CAST(attach); 264 + } 264 265 265 266 get_dma_buf(dma_buf); 266 267 ··· 287 282 fail_detach: 288 283 dma_buf_detach(dma_buf, attach); 289 284 dma_buf_put(dma_buf); 290 - 285 + put_device(dev->dev); 291 286 return ERR_PTR(ret); 292 287 }
+2
drivers/i2c/busses/i2c-cpm.c
··· 39 39 #include <linux/i2c.h> 40 40 #include <linux/io.h> 41 41 #include <linux/dma-mapping.h> 42 + #include <linux/of_address.h> 42 43 #include <linux/of_device.h> 44 + #include <linux/of_irq.h> 43 45 #include <linux/of_platform.h> 44 46 #include <sysdev/fsl_soc.h> 45 47 #include <asm/cpm.h>
+11 -1
drivers/input/keyboard/adp5588-keys.c
··· 76 76 struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); 77 77 unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); 78 78 unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); 79 + int val; 79 80 80 - return !!(adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank) & bit); 81 + mutex_lock(&kpad->gpio_lock); 82 + 83 + if (kpad->dir[bank] & bit) 84 + val = kpad->dat_out[bank]; 85 + else 86 + val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank); 87 + 88 + mutex_unlock(&kpad->gpio_lock); 89 + 90 + return !!(val & bit); 81 91 } 82 92 83 93 static void adp5588_gpio_set_value(struct gpio_chip *chip,
+17 -14
drivers/input/misc/da9052_onkey.c
··· 27 27 28 28 static void da9052_onkey_query(struct da9052_onkey *onkey) 29 29 { 30 - int key_stat; 30 + int ret; 31 31 32 - key_stat = da9052_reg_read(onkey->da9052, DA9052_EVENT_B_REG); 33 - if (key_stat < 0) { 32 + ret = da9052_reg_read(onkey->da9052, DA9052_STATUS_A_REG); 33 + if (ret < 0) { 34 34 dev_err(onkey->da9052->dev, 35 - "Failed to read onkey event %d\n", key_stat); 35 + "Failed to read onkey event err=%d\n", ret); 36 36 } else { 37 37 /* 38 38 * Since interrupt for deassertion of ONKEY pin is not 39 39 * generated, onkey event state determines the onkey 40 40 * button state. 41 41 */ 42 - key_stat &= DA9052_EVENTB_ENONKEY; 43 - input_report_key(onkey->input, KEY_POWER, key_stat); 44 - input_sync(onkey->input); 45 - } 42 + bool pressed = !(ret & DA9052_STATUSA_NONKEY); 46 43 47 - /* 48 - * Interrupt is generated only when the ONKEY pin is asserted. 49 - * Hence the deassertion of the pin is simulated through work queue. 50 - */ 51 - if (key_stat) 52 - schedule_delayed_work(&onkey->work, msecs_to_jiffies(50)); 44 + input_report_key(onkey->input, KEY_POWER, pressed); 45 + input_sync(onkey->input); 46 + 47 + /* 48 + * Interrupt is generated only when the ONKEY pin 49 + * is asserted. Hence the deassertion of the pin 50 + * is simulated through work queue. 51 + */ 52 + if (pressed) 53 + schedule_delayed_work(&onkey->work, 54 + msecs_to_jiffies(50)); 55 + } 53 56 } 54 57 55 58 static void da9052_onkey_work(struct work_struct *work)
-1
drivers/input/mouse/cypress_ps2.c
··· 409 409 __clear_bit(REL_X, input->relbit); 410 410 __clear_bit(REL_Y, input->relbit); 411 411 412 - __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); 413 412 __set_bit(EV_KEY, input->evbit); 414 413 __set_bit(BTN_LEFT, input->keybit); 415 414 __set_bit(BTN_RIGHT, input->keybit);
+55
drivers/input/mouse/synaptics.c
··· 265 265 * Read touchpad resolution and maximum reported coordinates 266 266 * Resolution is left zero if touchpad does not support the query 267 267 */ 268 + 269 + static const int *quirk_min_max; 270 + 268 271 static int synaptics_resolution(struct psmouse *psmouse) 269 272 { 270 273 struct synaptics_data *priv = psmouse->private; 271 274 unsigned char resp[3]; 275 + 276 + if (quirk_min_max) { 277 + priv->x_min = quirk_min_max[0]; 278 + priv->x_max = quirk_min_max[1]; 279 + priv->y_min = quirk_min_max[2]; 280 + priv->y_max = quirk_min_max[3]; 281 + return 0; 282 + } 272 283 273 284 if (SYN_ID_MAJOR(priv->identity) < 4) 274 285 return 0; ··· 1496 1485 { } 1497 1486 }; 1498 1487 1488 + static const struct dmi_system_id min_max_dmi_table[] __initconst = { 1489 + #if defined(CONFIG_DMI) 1490 + { 1491 + /* Lenovo ThinkPad Helix */ 1492 + .matches = { 1493 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1494 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"), 1495 + }, 1496 + .driver_data = (int []){1024, 5052, 2258, 4832}, 1497 + }, 1498 + { 1499 + /* Lenovo ThinkPad X240 */ 1500 + .matches = { 1501 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1502 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"), 1503 + }, 1504 + .driver_data = (int []){1232, 5710, 1156, 4696}, 1505 + }, 1506 + { 1507 + /* Lenovo ThinkPad T440s */ 1508 + .matches = { 1509 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1510 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"), 1511 + }, 1512 + .driver_data = (int []){1024, 5112, 2024, 4832}, 1513 + }, 1514 + { 1515 + /* Lenovo ThinkPad T540p */ 1516 + .matches = { 1517 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 1518 + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"), 1519 + }, 1520 + .driver_data = (int []){1024, 5056, 2058, 4832}, 1521 + }, 1522 + #endif 1523 + { } 1524 + }; 1525 + 1499 1526 void __init synaptics_module_init(void) 1500 1527 { 1528 + const struct dmi_system_id *min_max_dmi; 1529 + 1501 1530 impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); 1502 1531 broken_olpc_ec = dmi_check_system(olpc_dmi_table); 1532 + 1533 + min_max_dmi = dmi_first_match(min_max_dmi_table); 1534 + if (min_max_dmi) 1535 + quirk_min_max = min_max_dmi->driver_data; 1503 1536 } 1504 1537 1505 1538 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
+2 -3
drivers/net/ethernet/broadcom/tg3.c
··· 17641 17641 17642 17642 tg3_init_bufmgr_config(tp); 17643 17643 17644 - features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; 17645 - 17646 17644 /* 5700 B0 chips do not support checksumming correctly due 17647 17645 * to hardware bugs. 17648 17646 */ ··· 17672 17674 features |= NETIF_F_TSO_ECN; 17673 17675 } 17674 17676 17675 - dev->features |= features; 17677 + dev->features |= features | NETIF_F_HW_VLAN_CTAG_TX | 17678 + NETIF_F_HW_VLAN_CTAG_RX; 17676 17679 dev->vlan_features |= features; 17677 17680 17678 17681 /*
+9 -34
drivers/net/ethernet/marvell/mvneta.c
··· 89 89 #define MVNETA_TX_IN_PRGRS BIT(1) 90 90 #define MVNETA_TX_FIFO_EMPTY BIT(8) 91 91 #define MVNETA_RX_MIN_FRAME_SIZE 0x247c 92 - #define MVNETA_SGMII_SERDES_CFG 0x24A0 92 + #define MVNETA_SERDES_CFG 0x24A0 93 93 #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 94 + #define MVNETA_RGMII_SERDES_PROTO 0x0667 94 95 #define MVNETA_TYPE_PRIO 0x24bc 95 96 #define MVNETA_FORCE_UNI BIT(21) 96 97 #define MVNETA_TXQ_CMD_1 0x24e4 ··· 163 162 #define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc 164 163 #define MVNETA_GMAC0_PORT_ENABLE BIT(0) 165 164 #define MVNETA_GMAC_CTRL_2 0x2c08 166 - #define MVNETA_GMAC2_PSC_ENABLE BIT(3) 165 + #define MVNETA_GMAC2_PCS_ENABLE BIT(3) 167 166 #define MVNETA_GMAC2_PORT_RGMII BIT(4) 168 167 #define MVNETA_GMAC2_PORT_RESET BIT(6) 169 168 #define MVNETA_GMAC_STATUS 0x2c10 ··· 710 709 val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id)); 711 710 val &= ~MVNETA_RXQ_HW_BUF_ALLOC; 712 711 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 712 } 743 713 744 714 /* Start the Ethernet port RX and TX activity */ ··· 2729 2757 mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); 2730 2758 2731 2759 if (phy_mode == PHY_INTERFACE_MODE_SGMII) 2732 - mvneta_port_sgmii_config(pp); 2760 + mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); 2761 + else 2762 + mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_RGMII_SERDES_PROTO); 2733 2763 2734 - mvneta_gmac_rgmii_set(pp, 1); 2764 + val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 2765 + 2766 + val |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; 2735 2767 2736 2768 /* Cancel Port Reset */ 2737 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 2738 2769 val &= ~MVNETA_GMAC2_PORT_RESET; 2739 2770 mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 2740 2771
+5 -1
drivers/net/ethernet/mellanox/mlx4/main.c
··· 2755 2755 2756 2756 static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) 2757 2757 { 2758 - int ret = __mlx4_init_one(pdev, 0); 2758 + const struct pci_device_id *id; 2759 + int ret; 2760 + 2761 + id = pci_match_id(mlx4_pci_table, pdev); 2762 + ret = __mlx4_init_one(pdev, id->driver_data); 2759 2763 2760 2764 return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; 2761 2765 }
+3 -1
drivers/net/ethernet/qlogic/qlge/qlge_main.c
··· 4756 4756 ndev->features = ndev->hw_features; 4757 4757 ndev->vlan_features = ndev->hw_features; 4758 4758 /* vlan gets same features (except vlan filter) */ 4759 - ndev->vlan_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER; 4759 + ndev->vlan_features &= ~(NETIF_F_HW_VLAN_CTAG_FILTER | 4760 + NETIF_F_HW_VLAN_CTAG_TX | 4761 + NETIF_F_HW_VLAN_CTAG_RX); 4760 4762 4761 4763 if (test_bit(QL_DMA64, &qdev->flags)) 4762 4764 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
··· 278 278 dev->features |= NETIF_F_LLTX; 279 279 dev->features |= VETH_FEATURES; 280 280 dev->vlan_features = dev->features & 281 - ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); 281 + ~(NETIF_F_HW_VLAN_CTAG_TX | 282 + NETIF_F_HW_VLAN_STAG_TX | 283 + NETIF_F_HW_VLAN_CTAG_RX | 284 + NETIF_F_HW_VLAN_STAG_RX); 282 285 dev->destructor = veth_dev_free; 283 286 284 287 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 dev_kfree_skb_any(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))) {
+19 -7
drivers/xen/balloon.c
··· 399 399 state = BP_EAGAIN; 400 400 break; 401 401 } 402 - 403 - pfn = page_to_pfn(page); 404 - frame_list[i] = pfn_to_mfn(pfn); 405 - 406 402 scrub_page(page); 403 + 404 + frame_list[i] = page_to_pfn(page); 405 + } 406 + 407 + /* 408 + * Ensure that ballooned highmem pages don't have kmaps. 409 + * 410 + * Do this before changing the p2m as kmap_flush_unused() 411 + * reads PTEs to obtain pages (and hence needs the original 412 + * p2m entry). 413 + */ 414 + kmap_flush_unused(); 415 + 416 + /* Update direct mapping, invalidate P2M, and add to balloon. */ 417 + for (i = 0; i < nr_pages; i++) { 418 + pfn = frame_list[i]; 419 + frame_list[i] = pfn_to_mfn(pfn); 420 + page = pfn_to_page(pfn); 407 421 408 422 #ifdef CONFIG_XEN_HAVE_PVMMU 409 423 /* ··· 443 429 } 444 430 #endif 445 431 446 - balloon_append(pfn_to_page(pfn)); 432 + balloon_append(page); 447 433 } 448 434 449 - /* Ensure that ballooned highmem pages don't have kmaps. */ 450 - kmap_flush_unused(); 451 435 flush_tlb_all(); 452 436 453 437 set_xen_guest_handle(reservation.extent_start, frame_list);
+8 -26
fs/anon_inodes.c
··· 41 41 static struct dentry *anon_inodefs_mount(struct file_system_type *fs_type, 42 42 int flags, const char *dev_name, void *data) 43 43 { 44 - struct dentry *root; 45 - root = mount_pseudo(fs_type, "anon_inode:", NULL, 44 + return mount_pseudo(fs_type, "anon_inode:", NULL, 46 45 &anon_inodefs_dentry_operations, ANON_INODE_FS_MAGIC); 47 - if (!IS_ERR(root)) { 48 - struct super_block *s = root->d_sb; 49 - anon_inode_inode = alloc_anon_inode(s); 50 - if (IS_ERR(anon_inode_inode)) { 51 - dput(root); 52 - deactivate_locked_super(s); 53 - root = ERR_CAST(anon_inode_inode); 54 - } 55 - } 56 - return root; 57 46 } 58 47 59 48 static struct file_system_type anon_inode_fs_type = { ··· 164 175 165 176 static int __init anon_inode_init(void) 166 177 { 167 - int error; 168 - 169 - error = register_filesystem(&anon_inode_fs_type); 170 - if (error) 171 - goto err_exit; 172 178 anon_inode_mnt = kern_mount(&anon_inode_fs_type); 173 - if (IS_ERR(anon_inode_mnt)) { 174 - error = PTR_ERR(anon_inode_mnt); 175 - goto err_unregister_filesystem; 176 - } 177 - return 0; 179 + if (IS_ERR(anon_inode_mnt)) 180 + panic("anon_inode_init() kernel mount failed (%ld)\n", PTR_ERR(anon_inode_mnt)); 178 181 179 - err_unregister_filesystem: 180 - unregister_filesystem(&anon_inode_fs_type); 181 - err_exit: 182 - panic(KERN_ERR "anon_inode_init() failed (%d)\n", error); 182 + anon_inode_inode = alloc_anon_inode(anon_inode_mnt->mnt_sb); 183 + if (IS_ERR(anon_inode_inode)) 184 + panic("anon_inode_init() inode allocation failed (%ld)\n", PTR_ERR(anon_inode_inode)); 185 + 186 + return 0; 183 187 } 184 188 185 189 fs_initcall(anon_inode_init);
+3 -1
fs/ocfs2/stackglue.c
··· 346 346 347 347 strlcpy(new_conn->cc_name, group, GROUP_NAME_MAX + 1); 348 348 new_conn->cc_namelen = grouplen; 349 - strlcpy(new_conn->cc_cluster_name, cluster_name, CLUSTER_NAME_MAX + 1); 349 + if (cluster_name_len) 350 + strlcpy(new_conn->cc_cluster_name, cluster_name, 351 + CLUSTER_NAME_MAX + 1); 350 352 new_conn->cc_cluster_name_len = cluster_name_len; 351 353 new_conn->cc_recovery_handler = recovery_handler; 352 354 new_conn->cc_recovery_data = recovery_data;
+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
··· 3097 3097 { 3098 3098 return __skb_gso_segment(skb, features, true); 3099 3099 } 3100 - __be16 skb_network_protocol(struct sk_buff *skb); 3100 + __be16 skb_network_protocol(struct sk_buff *skb, int *depth); 3101 3101 3102 3102 static inline bool can_checksum_protocol(netdev_features_t features, 3103 3103 __be16 protocol)
+2 -2
include/linux/skbuff.h
··· 2508 2508 unsigned int flags); 2509 2509 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 2510 2510 unsigned int skb_zerocopy_headlen(const struct sk_buff *from); 2511 - void skb_zerocopy(struct sk_buff *to, const struct sk_buff *from, 2512 - int len, int hlen); 2511 + int skb_zerocopy(struct sk_buff *to, struct sk_buff *from, 2512 + int len, int hlen); 2513 2513 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len); 2514 2514 int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen); 2515 2515 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;
+25 -2
kernel/trace/trace.c
··· 1600 1600 } 1601 1601 EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit); 1602 1602 1603 + static struct ring_buffer *temp_buffer; 1604 + 1603 1605 struct ring_buffer_event * 1604 1606 trace_event_buffer_lock_reserve(struct ring_buffer **current_rb, 1605 1607 struct ftrace_event_file *ftrace_file, 1606 1608 int type, unsigned long len, 1607 1609 unsigned long flags, int pc) 1608 1610 { 1611 + struct ring_buffer_event *entry; 1612 + 1609 1613 *current_rb = ftrace_file->tr->trace_buffer.buffer; 1610 - return trace_buffer_lock_reserve(*current_rb, 1614 + entry = trace_buffer_lock_reserve(*current_rb, 1611 1615 type, len, flags, pc); 1616 + /* 1617 + * If tracing is off, but we have triggers enabled 1618 + * we still need to look at the event data. Use the temp_buffer 1619 + * to store the trace event for the tigger to use. It's recusive 1620 + * safe and will not be recorded anywhere. 1621 + */ 1622 + if (!entry && ftrace_file->flags & FTRACE_EVENT_FL_TRIGGER_COND) { 1623 + *current_rb = temp_buffer; 1624 + entry = trace_buffer_lock_reserve(*current_rb, 1625 + type, len, flags, pc); 1626 + } 1627 + return entry; 1612 1628 } 1613 1629 EXPORT_SYMBOL_GPL(trace_event_buffer_lock_reserve); 1614 1630 ··· 6510 6494 6511 6495 raw_spin_lock_init(&global_trace.start_lock); 6512 6496 6497 + /* Used for event triggers */ 6498 + temp_buffer = ring_buffer_alloc(PAGE_SIZE, RB_FL_OVERWRITE); 6499 + if (!temp_buffer) 6500 + goto out_free_cpumask; 6501 + 6513 6502 /* TODO: make the number of buffers hot pluggable with CPUS */ 6514 6503 if (allocate_trace_buffers(&global_trace, ring_buf_size) < 0) { 6515 6504 printk(KERN_ERR "tracer: failed to allocate ring buffer!\n"); 6516 6505 WARN_ON(1); 6517 - goto out_free_cpumask; 6506 + goto out_free_temp_buffer; 6518 6507 } 6519 6508 6520 6509 if (global_trace.buffer_disabled) ··· 6561 6540 6562 6541 return 0; 6563 6542 6543 + out_free_temp_buffer: 6544 + ring_buffer_free(temp_buffer); 6564 6545 out_free_cpumask: 6565 6546 free_percpu(global_trace.trace_buffer.data); 6566 6547 #ifdef CONFIG_TRACER_MAX_TRACE
+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
··· 2281 2281 } 2282 2282 EXPORT_SYMBOL(skb_checksum_help); 2283 2283 2284 - __be16 skb_network_protocol(struct sk_buff *skb) 2284 + __be16 skb_network_protocol(struct sk_buff *skb, int *depth) 2285 2285 { 2286 2286 __be16 type = skb->protocol; 2287 2287 int vlan_depth = ETH_HLEN; ··· 2308 2308 vlan_depth += VLAN_HLEN; 2309 2309 } 2310 2310 2311 + *depth = vlan_depth; 2312 + 2311 2313 return type; 2312 2314 } 2313 2315 ··· 2323 2321 { 2324 2322 struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); 2325 2323 struct packet_offload *ptype; 2326 - __be16 type = skb_network_protocol(skb); 2324 + int vlan_depth = skb->mac_len; 2325 + __be16 type = skb_network_protocol(skb, &vlan_depth); 2327 2326 2328 2327 if (unlikely(!type)) 2329 2328 return ERR_PTR(-EINVAL); 2330 2329 2331 - __skb_pull(skb, skb->mac_len); 2330 + __skb_pull(skb, vlan_depth); 2332 2331 2333 2332 rcu_read_lock(); 2334 2333 list_for_each_entry_rcu(ptype, &offload_base, list) { ··· 2496 2493 const struct net_device *dev, 2497 2494 netdev_features_t features) 2498 2495 { 2496 + int tmp; 2497 + 2499 2498 if (skb->ip_summed != CHECKSUM_NONE && 2500 - !can_checksum_protocol(features, skb_network_protocol(skb))) { 2499 + !can_checksum_protocol(features, skb_network_protocol(skb, &tmp))) { 2501 2500 features &= ~NETIF_F_ALL_CSUM; 2502 2501 } else if (illegal_highdma(dev, skb)) { 2503 2502 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
··· 420 420 421 421 #ifdef CONFIG_NET_IPGRE_BROADCAST 422 422 if (ipv4_is_multicast(iph->daddr)) { 423 - /* Looped back packet, drop it! */ 424 - if (rt_is_output_route(skb_rtable(skb))) 425 - goto drop; 426 423 tunnel->dev->stats.multicast++; 427 424 skb->pkt_type = PACKET_BROADCAST; 428 425 }
+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