History

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

Pull networking fixes from David Miller: 1) Fix null deref in xt_TEE netfilter module, from Eric Dumazet. 2) Several spots need to get to the original listner for SYN-ACK packets, most spots got this ok but some were not. Whilst covering the remaining cases, create a helper to do this. From Eric Dumazet. 3) Missiing check of return value from alloc_netdev() in CAIF SPI code, from Rasmus Villemoes. 4) Don't sleep while != TASK_RUNNING in macvtap, from Vlad Yasevich. 5) Use after free in mvneta driver, from Justin Maggard. 6) Fix race on dst->flags access in dst_release(), from Eric Dumazet. 7) Add missing ZLIB_INFLATE dependency for new qed driver. From Arnd Bergmann. 8) Fix multicast getsockopt deadlock, from WANG Cong. 9) Fix deadlock in btusb, from Kuba Pawlak. 10) Some ipv6_add_dev() failure paths were not cleaning up the SNMP6 counter state. From Sabrina Dubroca. 11) Fix packet_bind() race, which can cause lost notifications, from Francesco Ruggeri. 12) Fix MAC restoration in qlcnic driver during bonding mode changes, from Jarod Wilson. 13) Revert bridging forward delay change which broke libvirt and other userspace things, from Vlad Yasevich. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (65 commits) Revert "bridge: Allow forward delay to be cfgd when STP enabled" bpf_trace: Make dependent on PERF_EVENTS qed: select ZLIB_INFLATE net: fix a race in dst_release() net: mvneta: Fix memory use after free. net: Documentation: Fix default value tcp_limit_output_bytes macvtap: Resolve possible __might_sleep warning in macvtap_do_read() mvneta: add FIXED_PHY dependency net: caif: check return value of alloc_netdev net: hisilicon: NET_VENDOR_HISILICON should depend on HAS_DMA drivers: net: xgene: fix RGMII 10/100Mb mode netfilter: nft_meta: use skb_to_full_sk() helper net_sched: em_meta: use skb_to_full_sk() helper sched: cls_flow: use skb_to_full_sk() helper netfilter: xt_owner: use skb_to_full_sk() helper smack: use skb_to_full_sk() helper net: add skb_to_full_sk() helper and use it in selinux_netlbl_skbuff_setsid() bpf: doc: correct arch list for supported eBPF JIT dwc_eth_qos: Delete an unnecessary check before the function call "of_node_put" bonding: fix panic on non-ARPHRD_ETHER enslave failure ...

Linus Torvalds committed 11 years ago

Commit 2df4ee72 parents 3419b45 8a9212668 files · +642 −322Browse files

Unified · Split

68 files
  1. Documentation/devicetree/bindings/net/cpsw.txt +5 −0
  2. Documentation/networking/filter.txt +3 −3
  3. Documentation/networking/ip-sysctl.txt +1 −1
  4. drivers/bluetooth/btusb.c +4 −2
  5. drivers/net/bonding/bond_main.c +1 −0
  6. drivers/net/caif/caif_spi.c +5 −2
  7. drivers/net/dsa/mv88e6171.c +2 −0
  8. drivers/net/dsa/mv88e6352.c +2 −0
  9. drivers/net/dsa/mv88e6xxx.c +42 −0
  10. drivers/net/dsa/mv88e6xxx.h +2 −0
  11. drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +47 −2
  12. drivers/net/ethernet/apm/xgene/xgene_enet_hw.h +1 −0
  13. drivers/net/ethernet/apm/xgene/xgene_enet_main.c +0 −1
  14. drivers/net/ethernet/broadcom/Kconfig +1 −0
  15. drivers/net/ethernet/broadcom/bnxt/bnxt.c +21 −7
  16. drivers/net/ethernet/broadcom/bnxt/bnxt.h +16 −10
  17. drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +27 −13
  18. drivers/net/ethernet/hisilicon/Kconfig +2 −1
  19. drivers/net/ethernet/marvell/Kconfig +1 −0
  20. drivers/net/ethernet/marvell/mvneta.c +1 −1
  21. drivers/net/ethernet/qlogic/Kconfig +1 −0
  22. drivers/net/ethernet/qlogic/qed/qed_dev.c +10 −4
  23. drivers/net/ethernet/qlogic/qed/qed_int.c +0 −5
  24. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +2 −1
  25. drivers/net/ethernet/renesas/sh_eth.c +30 −54
  26. drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1 −1
  27. drivers/net/ethernet/synopsys/dwc_eth_qos.c +1 −2
  28. drivers/net/ethernet/ti/cpsw.c +13 −0
  29. drivers/net/fjes/fjes_hw.c +1 −3
  30. drivers/net/macvtap.c +3 −2
  31. drivers/net/usb/qmi_wwan.c +21 −0
  32. drivers/nfc/nfcmrvl/Kconfig +1 −1
  33. drivers/nfc/nfcmrvl/fw_dnld.c +9 −3
  34. drivers/nfc/nfcmrvl/main.c +3 −12
  35. drivers/nfc/nfcmrvl/uart.c +9 −17
  36. include/linux/netdevice.h +1 −0
  37. include/linux/tcp.h +7 −0
  38. include/net/bluetooth/l2cap.h +2 −0
  39. include/net/dst_metadata.h +2 −1
  40. include/net/inet_sock.h +12 −0
  41. kernel/trace/Kconfig +1 −1
  42. lib/test_bpf.c +30 −0
  43. net/bluetooth/hci_core.c +11 −6
  44. net/bluetooth/l2cap_core.c +17 −3
  45. net/bridge/br_stp.c +9 −4
  46. net/core/dev.c +4 −3
  47. net/core/dst.c +1 −1
  48. net/ipv4/fib_semantics.c +10 −3
  49. net/ipv4/igmp.c +4 −8
  50. net/ipv4/ip_sockglue.c +30 −15
  51. net/ipv4/netfilter/nf_defrag_ipv4.c +2 −3
  52. net/ipv4/sysctl_net_ipv4.c +2 −2
  53. net/ipv4/tcp_ipv4.c +2 −0
  54. net/ipv4/tcp_minisocks.c +0 −3
  55. net/ipv6/addrconf.c +1 −0
  56. net/ipv6/tcp_ipv6.c +12 −8
  57. net/netfilter/nf_nat_redirect.c +1 −1
  58. net/netfilter/nfnetlink.c +1 −1
  59. net/netfilter/nft_meta.c +20 −16
  60. net/netfilter/xt_TEE.c +4 −2
  61. net/netfilter/xt_owner.c +4 −2
  62. net/packet/af_packet.c +49 −31
  63. net/sched/cls_flow.c +11 −4
  64. net/sched/em_meta.c +92 −46
  65. net/vmw_vsock/vmci_transport.c +1 −1
  66. security/selinux/hooks.c +2 −4
  67. security/selinux/netlabel.c +1 −1
  68. security/smack/smack_netfilter.c +7 −4
Documentation/devicetree/bindings/net/cpsw.txt+5−0
@@ -48,6 +48,11 @@ Optional properties: · 47 unmodified lines
48- mac-address : See ethernet.txt file in the same directory48- mac-address : See ethernet.txt file in the same directory
49- phy-handle : See ethernet.txt file in the same directory49- phy-handle : See ethernet.txt file in the same directory
50 50
51Slave sub-nodes:
52- fixed-link : See fixed-link.txt file in the same directory
53 Either the properties phy_id and phy-mode,
54 or the sub-node fixed-link can be specified
55
51Note: "ti,hwmods" field is used to fetch the base address and irq56Note: "ti,hwmods" field is used to fetch the base address and irq
52resources from TI, omap hwmod data base during device registration.57resources from TI, omap hwmod data base during device registration.
53Future plan is to migrate hwmod data base contents into device tree58Future plan is to migrate hwmod data base contents into device tree
Documentation/networking/filter.txt+3−3
@@ -596,9 +596,9 @@ skb pointer). All constraints and restrictions from bpf_check_classic() apply · 595 unmodified lines
596before a conversion to the new layout is being done behind the scenes!596before a conversion to the new layout is being done behind the scenes!
597 597
598Currently, the classic BPF format is being used for JITing on most of the598Currently, the classic BPF format is being used for JITing on most of the
599architectures. Only x86-64 performs JIT compilation from eBPF instruction set,599architectures. x86-64, aarch64 and s390x perform JIT compilation from eBPF
600however, future work will migrate other JIT compilers as well, so that they600instruction set, however, future work will migrate other JIT compilers as well,
601will profit from the very same benefits.601so that they will profit from the very same benefits.
602 602
603Some core changes of the new internal format:603Some core changes of the new internal format:
604 604
Documentation/networking/ip-sysctl.txt+1−1
@@ -709,7 +709,7 @@ tcp_limit_output_bytes - INTEGER · 708 unmodified lines
709 typical pfifo_fast qdiscs.709 typical pfifo_fast qdiscs.
710 tcp_limit_output_bytes limits the number of bytes on qdisc710 tcp_limit_output_bytes limits the number of bytes on qdisc
711 or device to reduce artificial RTT/cwnd and reduce bufferbloat.711 or device to reduce artificial RTT/cwnd and reduce bufferbloat.
712 Default: 131072712 Default: 262144
713 713
714tcp_challenge_ack_limit - INTEGER714tcp_challenge_ack_limit - INTEGER
715 Limits number of Challenge ACK sent per second, as recommended715 Limits number of Challenge ACK sent per second, as recommended
drivers/bluetooth/btusb.c+4−2
@@ -1372,6 +1372,8 @@ static void btusb_work(struct work_struct *work) · 1371 unmodified lines
1372 }1372 }
1373 1373
1374 if (data->isoc_altsetting != new_alts) {1374 if (data->isoc_altsetting != new_alts) {
1375 unsigned long flags;
1376
1375 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);1377 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
1376 usb_kill_anchored_urbs(&data->isoc_anchor);1378 usb_kill_anchored_urbs(&data->isoc_anchor);
1377 1379
@@ -1384,10 +1386,10 @@ static void btusb_work(struct work_struct *work) · 6 unmodified lines
1384 * Clear outstanding fragment when selecting a new1386 * Clear outstanding fragment when selecting a new
1385 * alternate setting.1387 * alternate setting.
1386 */1388 */
1387 spin_lock(&data->rxlock);1389 spin_lock_irqsave(&data->rxlock, flags);
1388 kfree_skb(data->sco_skb);1390 kfree_skb(data->sco_skb);
1389 data->sco_skb = NULL;1391 data->sco_skb = NULL;
1390 spin_unlock(&data->rxlock);1392 spin_unlock_irqrestore(&data->rxlock, flags);
1391 1393
1392 if (__set_isoc_interface(hdev, new_alts) < 0)1394 if (__set_isoc_interface(hdev, new_alts) < 0)
1393 return;1395 return;
drivers/net/bonding/bond_main.c+1−0
@@ -1749,6 +1749,7 @@ err_undo_flags: · 1748 unmodified lines
1749 slave_dev->dev_addr))1749 slave_dev->dev_addr))
1750 eth_hw_addr_random(bond_dev);1750 eth_hw_addr_random(bond_dev);
1751 if (bond_dev->type != ARPHRD_ETHER) {1751 if (bond_dev->type != ARPHRD_ETHER) {
1752 dev_close(bond_dev);
1752 ether_setup(bond_dev);1753 ether_setup(bond_dev);
1753 bond_dev->flags |= IFF_MASTER;1754 bond_dev->flags |= IFF_MASTER;
1754 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;1755 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
drivers/net/caif/caif_spi.c+5−2
@@ -730,11 +730,14 @@ int cfspi_spi_probe(struct platform_device *pdev) · 729 unmodified lines
730 int res;730 int res;
731 dev = (struct cfspi_dev *)pdev->dev.platform_data;731 dev = (struct cfspi_dev *)pdev->dev.platform_data;
732 732
733 ndev = alloc_netdev(sizeof(struct cfspi), "cfspi%d",
734 NET_NAME_UNKNOWN, cfspi_setup);
735 if (!dev)733 if (!dev)
736 return -ENODEV;734 return -ENODEV;
737 735
736 ndev = alloc_netdev(sizeof(struct cfspi), "cfspi%d",
737 NET_NAME_UNKNOWN, cfspi_setup);
738 if (!ndev)
739 return -ENOMEM;
740
738 cfspi = netdev_priv(ndev);741 cfspi = netdev_priv(ndev);
739 netif_stop_queue(ndev);742 netif_stop_queue(ndev);
740 cfspi->ndev = ndev;743 cfspi->ndev = ndev;
drivers/net/dsa/mv88e6171.c+2−0
@@ -103,6 +103,8 @@ struct dsa_switch_driver mv88e6171_switch_driver = { · 102 unmodified lines
103#endif103#endif
104 .get_regs_len = mv88e6xxx_get_regs_len,104 .get_regs_len = mv88e6xxx_get_regs_len,
105 .get_regs = mv88e6xxx_get_regs,105 .get_regs = mv88e6xxx_get_regs,
106 .port_join_bridge = mv88e6xxx_port_bridge_join,
107 .port_leave_bridge = mv88e6xxx_port_bridge_leave,
106 .port_stp_update = mv88e6xxx_port_stp_update,108 .port_stp_update = mv88e6xxx_port_stp_update,
107 .port_pvid_get = mv88e6xxx_port_pvid_get,109 .port_pvid_get = mv88e6xxx_port_pvid_get,
108 .port_vlan_prepare = mv88e6xxx_port_vlan_prepare,110 .port_vlan_prepare = mv88e6xxx_port_vlan_prepare,
drivers/net/dsa/mv88e6352.c+2−0
@@ -323,6 +323,8 @@ struct dsa_switch_driver mv88e6352_switch_driver = { · 322 unmodified lines
323 .set_eeprom = mv88e6352_set_eeprom,323 .set_eeprom = mv88e6352_set_eeprom,
324 .get_regs_len = mv88e6xxx_get_regs_len,324 .get_regs_len = mv88e6xxx_get_regs_len,
325 .get_regs = mv88e6xxx_get_regs,325 .get_regs = mv88e6xxx_get_regs,
326 .port_join_bridge = mv88e6xxx_port_bridge_join,
327 .port_leave_bridge = mv88e6xxx_port_bridge_leave,
326 .port_stp_update = mv88e6xxx_port_stp_update,328 .port_stp_update = mv88e6xxx_port_stp_update,
327 .port_pvid_get = mv88e6xxx_port_pvid_get,329 .port_pvid_get = mv88e6xxx_port_pvid_get,
328 .port_vlan_prepare = mv88e6xxx_port_vlan_prepare,330 .port_vlan_prepare = mv88e6xxx_port_vlan_prepare,
drivers/net/dsa/mv88e6xxx.c+42−0
@@ -1462,6 +1462,10 @@ int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, · 1461 unmodified lines
1462 const struct switchdev_obj_port_vlan *vlan,1462 const struct switchdev_obj_port_vlan *vlan,
1463 struct switchdev_trans *trans)1463 struct switchdev_trans *trans)
1464{1464{
1465 /* We reserve a few VLANs to isolate unbridged ports */
1466 if (vlan->vid_end >= 4000)
1467 return -EOPNOTSUPP;
1468
1465 /* We don't need any dynamic resource from the kernel (yet),1469 /* We don't need any dynamic resource from the kernel (yet),
1466 * so skip the prepare phase.1470 * so skip the prepare phase.
1467 */1471 */
@@ -1870,6 +1874,36 @@ unlock: · 402 unmodified lines
1870 return err;1874 return err;
1871}1875}
1872 1876
1877int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, u32 members)
1878{
1879 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
1880 const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port;
1881 int err;
1882
1883 /* The port joined a bridge, so leave its reserved VLAN */
1884 mutex_lock(&ps->smi_mutex);
1885 err = _mv88e6xxx_port_vlan_del(ds, port, pvid);
1886 if (!err)
1887 err = _mv88e6xxx_port_pvid_set(ds, port, 0);
1888 mutex_unlock(&ps->smi_mutex);
1889 return err;
1890}
1891
1892int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, u32 members)
1893{
1894 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
1895 const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port;
1896 int err;
1897
1898 /* The port left the bridge, so join its reserved VLAN */
1899 mutex_lock(&ps->smi_mutex);
1900 err = _mv88e6xxx_port_vlan_add(ds, port, pvid, true);
1901 if (!err)
1902 err = _mv88e6xxx_port_pvid_set(ds, port, pvid);
1903 mutex_unlock(&ps->smi_mutex);
1904 return err;
1905}
1906
1873static void mv88e6xxx_bridge_work(struct work_struct *work)1907static void mv88e6xxx_bridge_work(struct work_struct *work)
1874{1908{
1875 struct mv88e6xxx_priv_state *ps;1909 struct mv88e6xxx_priv_state *ps;
@@ -2140,6 +2174,14 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds) · 264 unmodified lines
2140 ret = mv88e6xxx_setup_port(ds, i);2174 ret = mv88e6xxx_setup_port(ds, i);
2141 if (ret < 0)2175 if (ret < 0)
2142 return ret;2176 return ret;
2177
2178 if (dsa_is_cpu_port(ds, i) || dsa_is_dsa_port(ds, i))
2179 continue;
2180
2181 /* setup the unbridged state */
2182 ret = mv88e6xxx_port_bridge_leave(ds, i, 0);
2183 if (ret < 0)
2184 return ret;
2143 }2185 }
2144 return 0;2186 return 0;
2145}2187}
drivers/net/dsa/mv88e6xxx.h+2−0
@@ -468,6 +468,8 @@ int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int addr, int regnum, · 467 unmodified lines
468int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);468int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
469int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,469int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
470 struct phy_device *phydev, struct ethtool_eee *e);470 struct phy_device *phydev, struct ethtool_eee *e);
471int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, u32 members);
472int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, u32 members);
471int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state);473int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state);
472int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,474int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
473 const struct switchdev_obj_port_vlan *vlan,475 const struct switchdev_obj_port_vlan *vlan,
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c+47−2
@@ -459,6 +459,45 @@ static void xgene_gmac_reset(struct xgene_enet_pdata *pdata) · 458 unmodified lines
459 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, 0);459 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, 0);
460}460}
461 461
462static void xgene_enet_configure_clock(struct xgene_enet_pdata *pdata)
463{
464 struct device *dev = &pdata->pdev->dev;
465
466 if (dev->of_node) {
467 struct clk *parent = clk_get_parent(pdata->clk);
468
469 switch (pdata->phy_speed) {
470 case SPEED_10:
471 clk_set_rate(parent, 2500000);
472 break;
473 case SPEED_100:
474 clk_set_rate(parent, 25000000);
475 break;
476 default:
477 clk_set_rate(parent, 125000000);
478 break;
479 }
480 }
481#ifdef CONFIG_ACPI
482 else {
483 switch (pdata->phy_speed) {
484 case SPEED_10:
485 acpi_evaluate_object(ACPI_HANDLE(dev),
486 "S10", NULL, NULL);
487 break;
488 case SPEED_100:
489 acpi_evaluate_object(ACPI_HANDLE(dev),
490 "S100", NULL, NULL);
491 break;
492 default:
493 acpi_evaluate_object(ACPI_HANDLE(dev),
494 "S1G", NULL, NULL);
495 break;
496 }
497 }
498#endif
499}
500
462static void xgene_gmac_init(struct xgene_enet_pdata *pdata)501static void xgene_gmac_init(struct xgene_enet_pdata *pdata)
463{502{
464 struct device *dev = &pdata->pdev->dev;503 struct device *dev = &pdata->pdev->dev;
@@ -477,12 +516,14 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 12 unmodified lines
477 switch (pdata->phy_speed) {516 switch (pdata->phy_speed) {
478 case SPEED_10:517 case SPEED_10:
479 ENET_INTERFACE_MODE2_SET(&mc2, 1);518 ENET_INTERFACE_MODE2_SET(&mc2, 1);
519 intf_ctl &= ~(ENET_LHD_MODE | ENET_GHD_MODE);
480 CFG_MACMODE_SET(&icm0, 0);520 CFG_MACMODE_SET(&icm0, 0);
481 CFG_WAITASYNCRD_SET(&icm2, 500);521 CFG_WAITASYNCRD_SET(&icm2, 500);
482 rgmii &= ~CFG_SPEED_1250;522 rgmii &= ~CFG_SPEED_1250;
483 break;523 break;
484 case SPEED_100:524 case SPEED_100:
485 ENET_INTERFACE_MODE2_SET(&mc2, 1);525 ENET_INTERFACE_MODE2_SET(&mc2, 1);
526 intf_ctl &= ~ENET_GHD_MODE;
486 intf_ctl |= ENET_LHD_MODE;527 intf_ctl |= ENET_LHD_MODE;
487 CFG_MACMODE_SET(&icm0, 1);528 CFG_MACMODE_SET(&icm0, 1);
488 CFG_WAITASYNCRD_SET(&icm2, 80);529 CFG_WAITASYNCRD_SET(&icm2, 80);
@@ -490,12 +531,15 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 1 unmodified line
490 break;531 break;
491 default:532 default:
492 ENET_INTERFACE_MODE2_SET(&mc2, 2);533 ENET_INTERFACE_MODE2_SET(&mc2, 2);
534 intf_ctl &= ~ENET_LHD_MODE;
493 intf_ctl |= ENET_GHD_MODE;535 intf_ctl |= ENET_GHD_MODE;
494 536 CFG_MACMODE_SET(&icm0, 2);
537 CFG_WAITASYNCRD_SET(&icm2, 0);
495 if (dev->of_node) {538 if (dev->of_node) {
496 CFG_TXCLK_MUXSEL0_SET(&rgmii, pdata->tx_delay);539 CFG_TXCLK_MUXSEL0_SET(&rgmii, pdata->tx_delay);
497 CFG_RXCLK_MUXSEL0_SET(&rgmii, pdata->rx_delay);540 CFG_RXCLK_MUXSEL0_SET(&rgmii, pdata->rx_delay);
498 }541 }
542 rgmii |= CFG_SPEED_1250;
499 543
500 xgene_enet_rd_csr(pdata, DEBUG_REG_ADDR, &value);544 xgene_enet_rd_csr(pdata, DEBUG_REG_ADDR, &value);
501 value |= CFG_BYPASS_UNISEC_TX | CFG_BYPASS_UNISEC_RX;545 value |= CFG_BYPASS_UNISEC_TX | CFG_BYPASS_UNISEC_RX;
@@ -503,7 +547,7 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 1 unmodified line
503 break;547 break;
504 }548 }
505 549
506 mc2 |= FULL_DUPLEX2;550 mc2 |= FULL_DUPLEX2 | PAD_CRC;
507 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_2_ADDR, mc2);551 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_2_ADDR, mc2);
508 xgene_enet_wr_mcx_mac(pdata, INTERFACE_CONTROL_ADDR, intf_ctl);552 xgene_enet_wr_mcx_mac(pdata, INTERFACE_CONTROL_ADDR, intf_ctl);
509 553
@@ -522,6 +566,7 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 12 unmodified lines
522 /* Rtype should be copied from FP */566 /* Rtype should be copied from FP */
523 xgene_enet_wr_csr(pdata, RSIF_RAM_DBG_REG0_ADDR, 0);567 xgene_enet_wr_csr(pdata, RSIF_RAM_DBG_REG0_ADDR, 0);
524 xgene_enet_wr_csr(pdata, RGMII_REG_0_ADDR, rgmii);568 xgene_enet_wr_csr(pdata, RGMII_REG_0_ADDR, rgmii);
569 xgene_enet_configure_clock(pdata);
525 570
526 /* Rx-Tx traffic resume */571 /* Rx-Tx traffic resume */
527 xgene_enet_wr_csr(pdata, CFG_LINK_AGGR_RESUME_0_ADDR, TX_PORT0);572 xgene_enet_wr_csr(pdata, CFG_LINK_AGGR_RESUME_0_ADDR, TX_PORT0);
drivers/net/ethernet/apm/xgene/xgene_enet_hw.h+1−0
@@ -181,6 +181,7 @@ enum xgene_enet_rm { · 180 unmodified lines
181#define ENET_LHD_MODE BIT(25)181#define ENET_LHD_MODE BIT(25)
182#define ENET_GHD_MODE BIT(26)182#define ENET_GHD_MODE BIT(26)
183#define FULL_DUPLEX2 BIT(0)183#define FULL_DUPLEX2 BIT(0)
184#define PAD_CRC BIT(2)
184#define SCAN_AUTO_INCR BIT(5)185#define SCAN_AUTO_INCR BIT(5)
185#define TBYT_ADDR 0x38186#define TBYT_ADDR 0x38
186#define TPKT_ADDR 0x39187#define TPKT_ADDR 0x39
drivers/net/ethernet/apm/xgene/xgene_enet_main.c+0−1
@@ -698,7 +698,6 @@ static int xgene_enet_open(struct net_device *ndev) · 697 unmodified lines
698 else698 else
699 schedule_delayed_work(&pdata->link_work, PHY_POLL_LINK_OFF);699 schedule_delayed_work(&pdata->link_work, PHY_POLL_LINK_OFF);
700 700
701 netif_carrier_off(ndev);
702 netif_start_queue(ndev);701 netif_start_queue(ndev);
703 702
704 return ret;703 return ret;
drivers/net/ethernet/broadcom/Kconfig+1−0
@@ -173,6 +173,7 @@ config SYSTEMPORT · 172 unmodified lines
173config BNXT173config BNXT
174 tristate "Broadcom NetXtreme-C/E support"174 tristate "Broadcom NetXtreme-C/E support"
175 depends on PCI175 depends on PCI
176 depends on VXLAN || VXLAN=n
176 select FW_LOADER177 select FW_LOADER
177 select LIBCRC32C178 select LIBCRC32C
178 ---help---179 ---help---
drivers/net/ethernet/broadcom/bnxt/bnxt.c+21−7
@@ -1292,8 +1292,6 @@ static inline int bnxt_has_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr) · 1291 unmodified lines
1292 return TX_CMP_VALID(txcmp, raw_cons);1292 return TX_CMP_VALID(txcmp, raw_cons);
1293}1293}
1294 1294
1295#define CAG_LEGACY_INT_STATUS 0x2014
1296
1297static irqreturn_t bnxt_inta(int irq, void *dev_instance)1295static irqreturn_t bnxt_inta(int irq, void *dev_instance)
1298{1296{
1299 struct bnxt_napi *bnapi = dev_instance;1297 struct bnxt_napi *bnapi = dev_instance;
@@ -1305,7 +1303,7 @@ static irqreturn_t bnxt_inta(int irq, void *dev_instance) · 5 unmodified lines
1305 prefetch(&cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)]);1303 prefetch(&cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)]);
1306 1304
1307 if (!bnxt_has_work(bp, cpr)) {1305 if (!bnxt_has_work(bp, cpr)) {
1308 int_status = readl(bp->bar0 + CAG_LEGACY_INT_STATUS);1306 int_status = readl(bp->bar0 + BNXT_CAG_REG_LEGACY_INT_STATUS);
1309 /* return if erroneous interrupt */1307 /* return if erroneous interrupt */
1310 if (!(int_status & (0x10000 << cpr->cp_ring_struct.fw_ring_id)))1308 if (!(int_status & (0x10000 << cpr->cp_ring_struct.fw_ring_id)))
1311 return IRQ_NONE;1309 return IRQ_NONE;
@@ -4527,10 +4525,25 @@ static int bnxt_update_phy_setting(struct bnxt *bp) · 3215 unmodified lines
4527 return rc;4525 return rc;
4528}4526}
4529 4527
4528/* Common routine to pre-map certain register block to different GRC window.
4529 * A PF has 16 4K windows and a VF has 4 4K windows. However, only 15 windows
4530 * in PF and 3 windows in VF that can be customized to map in different
4531 * register blocks.
4532 */
4533static void bnxt_preset_reg_win(struct bnxt *bp)
4534{
4535 if (BNXT_PF(bp)) {
4536 /* CAG registers map to GRC window #4 */
4537 writel(BNXT_CAG_REG_BASE,
4538 bp->bar0 + BNXT_GRCPF_REG_WINDOW_BASE_OUT + 12);
4539 }
4540}
4541
4530static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)4542static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
4531{4543{
4532 int rc = 0;4544 int rc = 0;
4533 4545
4546 bnxt_preset_reg_win(bp);
4534 netif_carrier_off(bp->dev);4547 netif_carrier_off(bp->dev);
4535 if (irq_re_init) {4548 if (irq_re_init) {
4536 rc = bnxt_setup_int_mode(bp);4549 rc = bnxt_setup_int_mode(bp);
@@ -5294,7 +5307,7 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, · 757 unmodified lines
5294 struct bnxt_ntuple_filter *fltr, *new_fltr;5307 struct bnxt_ntuple_filter *fltr, *new_fltr;
5295 struct flow_keys *fkeys;5308 struct flow_keys *fkeys;
5296 struct ethhdr *eth = (struct ethhdr *)skb_mac_header(skb);5309 struct ethhdr *eth = (struct ethhdr *)skb_mac_header(skb);
5297 int rc = 0, idx;5310 int rc = 0, idx, bit_id;
5298 struct hlist_head *head;5311 struct hlist_head *head;
5299 5312
5300 if (skb->encapsulation)5313 if (skb->encapsulation)
@@ -5332,14 +5345,15 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, · 31 unmodified lines
5332 rcu_read_unlock();5345 rcu_read_unlock();
5333 5346
5334 spin_lock_bh(&bp->ntp_fltr_lock);5347 spin_lock_bh(&bp->ntp_fltr_lock);
5335 new_fltr->sw_id = bitmap_find_free_region(bp->ntp_fltr_bmap,5348 bit_id = bitmap_find_free_region(bp->ntp_fltr_bmap,
5336 BNXT_NTP_FLTR_MAX_FLTR, 0);5349 BNXT_NTP_FLTR_MAX_FLTR, 0);
5337 if (new_fltr->sw_id < 0) {5350 if (bit_id < 0) {
5338 spin_unlock_bh(&bp->ntp_fltr_lock);5351 spin_unlock_bh(&bp->ntp_fltr_lock);
5339 rc = -ENOMEM;5352 rc = -ENOMEM;
5340 goto err_free;5353 goto err_free;
5341 }5354 }
5342 5355
5356 new_fltr->sw_id = (u16)bit_id;
5343 new_fltr->flow_id = flow_id;5357 new_fltr->flow_id = flow_id;
5344 new_fltr->rxq = rxq_index;5358 new_fltr->rxq = rxq_index;
5345 hlist_add_head_rcu(&new_fltr->hash, head);5359 hlist_add_head_rcu(&new_fltr->hash, head);
drivers/net/ethernet/broadcom/bnxt/bnxt.h+16−10
@@ -166,9 +166,11 @@ struct rx_cmp { · 165 unmodified lines
166#define RX_CMP_HASH_VALID(rxcmp) \166#define RX_CMP_HASH_VALID(rxcmp) \
167 ((rxcmp)->rx_cmp_len_flags_type & cpu_to_le32(RX_CMP_FLAGS_RSS_VALID))167 ((rxcmp)->rx_cmp_len_flags_type & cpu_to_le32(RX_CMP_FLAGS_RSS_VALID))
168 168
169#define RSS_PROFILE_ID_MASK 0x1f
170
169#define RX_CMP_HASH_TYPE(rxcmp) \171#define RX_CMP_HASH_TYPE(rxcmp) \
170 ((le32_to_cpu((rxcmp)->rx_cmp_misc_v1) & RX_CMP_RSS_HASH_TYPE) >>\172 (((le32_to_cpu((rxcmp)->rx_cmp_misc_v1) & RX_CMP_RSS_HASH_TYPE) >>\
171 RX_CMP_RSS_HASH_TYPE_SHIFT)173 RX_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK)
172 174
173struct rx_cmp_ext {175struct rx_cmp_ext {
174 __le32 rx_cmp_flags2;176 __le32 rx_cmp_flags2;
@@ -282,9 +284,9 @@ struct rx_tpa_start_cmp { · 107 unmodified lines
282 cpu_to_le32(RX_TPA_START_CMP_FLAGS_RSS_VALID))284 cpu_to_le32(RX_TPA_START_CMP_FLAGS_RSS_VALID))
283 285
284#define TPA_START_HASH_TYPE(rx_tpa_start) \286#define TPA_START_HASH_TYPE(rx_tpa_start) \
285 ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \287 (((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \
286 RX_TPA_START_CMP_RSS_HASH_TYPE) >> \288 RX_TPA_START_CMP_RSS_HASH_TYPE) >> \
287 RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT)289 RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK)
288 290
289#define TPA_START_AGG_ID(rx_tpa_start) \291#define TPA_START_AGG_ID(rx_tpa_start) \
290 ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \292 ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \
@@ -839,6 +841,10 @@ struct bnxt_queue_info { · 548 unmodified lines
839 u8 queue_profile;841 u8 queue_profile;
840};842};
841 843
844#define BNXT_GRCPF_REG_WINDOW_BASE_OUT 0x400
845#define BNXT_CAG_REG_LEGACY_INT_STATUS 0x4014
846#define BNXT_CAG_REG_BASE 0x300000
847
842struct bnxt {848struct bnxt {
843 void __iomem *bar0;849 void __iomem *bar0;
844 void __iomem *bar1;850 void __iomem *bar1;
@@ -959,11 +965,11 @@ struct bnxt { · 114 unmodified lines
959#define BNXT_RX_MASK_SP_EVENT 0965#define BNXT_RX_MASK_SP_EVENT 0
960#define BNXT_RX_NTP_FLTR_SP_EVENT 1966#define BNXT_RX_NTP_FLTR_SP_EVENT 1
961#define BNXT_LINK_CHNG_SP_EVENT 2967#define BNXT_LINK_CHNG_SP_EVENT 2
962#define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT 4968#define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT 3
963#define BNXT_VXLAN_ADD_PORT_SP_EVENT 8969#define BNXT_VXLAN_ADD_PORT_SP_EVENT 4
964#define BNXT_VXLAN_DEL_PORT_SP_EVENT 16970#define BNXT_VXLAN_DEL_PORT_SP_EVENT 5
965#define BNXT_RESET_TASK_SP_EVENT 32971#define BNXT_RESET_TASK_SP_EVENT 6
966#define BNXT_RST_RING_SP_EVENT 64972#define BNXT_RST_RING_SP_EVENT 7
967 973
968 struct bnxt_pf_info pf;974 struct bnxt_pf_info pf;
969#ifdef CONFIG_BNXT_SRIOV975#ifdef CONFIG_BNXT_SRIOV
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c+27−13
@@ -258,7 +258,7 @@ static int bnxt_set_vf_attr(struct bnxt *bp, int num_vfs) · 257 unmodified lines
258 return 0;258 return 0;
259}259}
260 260
261static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp)261static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp, int num_vfs)
262{262{
263 int i, rc = 0;263 int i, rc = 0;
264 struct bnxt_pf_info *pf = &bp->pf;264 struct bnxt_pf_info *pf = &bp->pf;
@@ -267,7 +267,7 @@ static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp) · 2 unmodified lines
267 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESC_FREE, -1, -1);267 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESC_FREE, -1, -1);
268 268
269 mutex_lock(&bp->hwrm_cmd_lock);269 mutex_lock(&bp->hwrm_cmd_lock);
270 for (i = pf->first_vf_id; i < pf->first_vf_id + pf->active_vfs; i++) {270 for (i = pf->first_vf_id; i < pf->first_vf_id + num_vfs; i++) {
271 req.vf_id = cpu_to_le16(i);271 req.vf_id = cpu_to_le16(i);
272 rc = _hwrm_send_message(bp, &req, sizeof(req),272 rc = _hwrm_send_message(bp, &req, sizeof(req),
273 HWRM_CMD_TIMEOUT);273 HWRM_CMD_TIMEOUT);
@@ -509,7 +509,7 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) · 235 unmodified lines
509 509
510err_out2:510err_out2:
511 /* Free the resources reserved for various VF's */511 /* Free the resources reserved for various VF's */
512 bnxt_hwrm_func_vf_resource_free(bp);512 bnxt_hwrm_func_vf_resource_free(bp, *num_vfs);
513 513
514err_out1:514err_out1:
515 bnxt_free_vf_resources(bp);515 bnxt_free_vf_resources(bp);
@@ -519,13 +519,19 @@ err_out1: · 3 unmodified lines
519 519
520void bnxt_sriov_disable(struct bnxt *bp)520void bnxt_sriov_disable(struct bnxt *bp)
521{521{
522 if (!bp->pf.active_vfs)522 u16 num_vfs = pci_num_vf(bp->pdev);
523 return;
524 523
525 pci_disable_sriov(bp->pdev);524 if (!num_vfs)
525 return;
526 526
527 /* Free the resources reserved for various VF's */527 if (pci_vfs_assigned(bp->pdev)) {
528 bnxt_hwrm_func_vf_resource_free(bp);528 netdev_warn(bp->dev, "Unable to free %d VFs because some are assigned to VMs.\n",
529 num_vfs);
530 } else {
531 pci_disable_sriov(bp->pdev);
532 /* Free the HW resources reserved for various VF's */
533 bnxt_hwrm_func_vf_resource_free(bp, num_vfs);
534 }
529 535
530 bnxt_free_vf_resources(bp);536 bnxt_free_vf_resources(bp);
531 537
@@ -552,17 +558,25 @@ int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) · 20 unmodified lines
552 }558 }
553 bp->sriov_cfg = true;559 bp->sriov_cfg = true;
554 rtnl_unlock();560 rtnl_unlock();
555 if (!num_vfs) {561
556 bnxt_sriov_disable(bp);562 if (pci_vfs_assigned(bp->pdev)) {
557 return 0;563 netdev_warn(dev, "Unable to configure SRIOV since some VFs are assigned to VMs.\n");
564 num_vfs = 0;
565 goto sriov_cfg_exit;
558 }566 }
559 567
560 /* Check if enabled VFs is same as requested */568 /* Check if enabled VFs is same as requested */
561 if (num_vfs == bp->pf.active_vfs)569 if (num_vfs && num_vfs == bp->pf.active_vfs)
562 return 0;570 goto sriov_cfg_exit;
571
572 /* if there are previous existing VFs, clean them up */
573 bnxt_sriov_disable(bp);
574 if (!num_vfs)
575 goto sriov_cfg_exit;
563 576
564 bnxt_sriov_enable(bp, &num_vfs);577 bnxt_sriov_enable(bp, &num_vfs);
565 578
579sriov_cfg_exit:
566 bp->sriov_cfg = false;580 bp->sriov_cfg = false;
567 wake_up(&bp->sriov_cfg_wait);581 wake_up(&bp->sriov_cfg_wait);
568 582
drivers/net/ethernet/hisilicon/Kconfig+2−1
@@ -5,7 +5,8 @@ · 4 unmodified lines
5config NET_VENDOR_HISILICON5config NET_VENDOR_HISILICON
6 bool "Hisilicon devices"6 bool "Hisilicon devices"
7 default y7 default y
8 depends on OF && (ARM || ARM64 || COMPILE_TEST)8 depends on OF && HAS_DMA
9 depends on ARM || ARM64 || COMPILE_TEST
9 ---help---10 ---help---
10 If you have a network (Ethernet) card belonging to this class, say Y.11 If you have a network (Ethernet) card belonging to this class, say Y.
11 12
drivers/net/ethernet/marvell/Kconfig+1−0
@@ -44,6 +44,7 @@ config MVNETA · 43 unmodified lines
44 tristate "Marvell Armada 370/38x/XP network interface support"44 tristate "Marvell Armada 370/38x/XP network interface support"
45 depends on PLAT_ORION45 depends on PLAT_ORION
46 select MVMDIO46 select MVMDIO
47 select FIXED_PHY
47 ---help---48 ---help---
48 This driver supports the network interface units in the49 This driver supports the network interface units in the
49 Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family.50 Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family.
drivers/net/ethernet/marvell/mvneta.c+1−1
@@ -1493,9 +1493,9 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp, · 1492 unmodified lines
1493 struct mvneta_rx_desc *rx_desc = rxq->descs + i;1493 struct mvneta_rx_desc *rx_desc = rxq->descs + i;
1494 void *data = (void *)rx_desc->buf_cookie;1494 void *data = (void *)rx_desc->buf_cookie;
1495 1495
1496 mvneta_frag_free(pp, data);
1497 dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,1496 dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
1498 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);1497 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
1498 mvneta_frag_free(pp, data);
1499 }1499 }
1500 1500
1501 if (rx_done)1501 if (rx_done)
drivers/net/ethernet/qlogic/Kconfig+1−0
@@ -94,6 +94,7 @@ config NETXEN_NIC · 93 unmodified lines
94config QED94config QED
95 tristate "QLogic QED 25/40/100Gb core driver"95 tristate "QLogic QED 25/40/100Gb core driver"
96 depends on PCI96 depends on PCI
97 select ZLIB_INFLATE
97 ---help---98 ---help---
98 This enables the support for ...99 This enables the support for ...
99 100
drivers/net/ethernet/qlogic/qed/qed_dev.c+10−4
@@ -223,6 +223,7 @@ int qed_resc_alloc(struct qed_dev *cdev) · 222 unmodified lines
223 if (!p_hwfn->p_tx_cids) {223 if (!p_hwfn->p_tx_cids) {
224 DP_NOTICE(p_hwfn,224 DP_NOTICE(p_hwfn,
225 "Failed to allocate memory for Tx Cids\n");225 "Failed to allocate memory for Tx Cids\n");
226 rc = -ENOMEM;
226 goto alloc_err;227 goto alloc_err;
227 }228 }
228 229
@@ -230,6 +231,7 @@ int qed_resc_alloc(struct qed_dev *cdev) · 1 unmodified line
230 if (!p_hwfn->p_rx_cids) {231 if (!p_hwfn->p_rx_cids) {
231 DP_NOTICE(p_hwfn,232 DP_NOTICE(p_hwfn,
232 "Failed to allocate memory for Rx Cids\n");233 "Failed to allocate memory for Rx Cids\n");
234 rc = -ENOMEM;
233 goto alloc_err;235 goto alloc_err;
234 }236 }
235 }237 }
@@ -281,14 +283,17 @@ int qed_resc_alloc(struct qed_dev *cdev) · 45 unmodified lines
281 283
282 /* EQ */284 /* EQ */
283 p_eq = qed_eq_alloc(p_hwfn, 256);285 p_eq = qed_eq_alloc(p_hwfn, 256);
284 286 if (!p_eq) {
285 if (!p_eq)287 rc = -ENOMEM;
286 goto alloc_err;288 goto alloc_err;
289 }
287 p_hwfn->p_eq = p_eq;290 p_hwfn->p_eq = p_eq;
288 291
289 p_consq = qed_consq_alloc(p_hwfn);292 p_consq = qed_consq_alloc(p_hwfn);
290 if (!p_consq)293 if (!p_consq) {
294 rc = -ENOMEM;
291 goto alloc_err;295 goto alloc_err;
296 }
292 p_hwfn->p_consq = p_consq;297 p_hwfn->p_consq = p_consq;
293 298
294 /* DMA info initialization */299 /* DMA info initialization */
@@ -303,6 +308,7 @@ int qed_resc_alloc(struct qed_dev *cdev) · 8 unmodified lines
303 cdev->reset_stats = kzalloc(sizeof(*cdev->reset_stats), GFP_KERNEL);308 cdev->reset_stats = kzalloc(sizeof(*cdev->reset_stats), GFP_KERNEL);
304 if (!cdev->reset_stats) {309 if (!cdev->reset_stats) {
305 DP_NOTICE(cdev, "Failed to allocate reset statistics\n");310 DP_NOTICE(cdev, "Failed to allocate reset statistics\n");
311 rc = -ENOMEM;
306 goto alloc_err;312 goto alloc_err;
307 }313 }
308 314
@@ -562,7 +568,7 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn, · 253 unmodified lines
562 }568 }
563 569
564 /* Enable classification by MAC if needed */570 /* Enable classification by MAC if needed */
565 if (hw_mode & MODE_MF_SI) {571 if (hw_mode & (1 << MODE_MF_SI)) {
566 DP_VERBOSE(p_hwfn, NETIF_MSG_HW,572 DP_VERBOSE(p_hwfn, NETIF_MSG_HW,
567 "Configuring TAGMAC_CLS_TYPE\n");573 "Configuring TAGMAC_CLS_TYPE\n");
568 STORE_RT_REG(p_hwfn,574 STORE_RT_REG(p_hwfn,
drivers/net/ethernet/qlogic/qed/qed_int.c+0−5
@@ -251,11 +251,6 @@ void qed_int_sp_dpc(unsigned long hwfn_cookie) · 250 unmodified lines
251 int arr_size;251 int arr_size;
252 u16 rc = 0;252 u16 rc = 0;
253 253
254 if (!p_hwfn) {
255 DP_ERR(p_hwfn->cdev, "DPC called - no hwfn!\n");
256 return;
257 }
258
259 if (!p_hwfn->p_sp_sb) {254 if (!p_hwfn->p_sp_sb) {
260 DP_ERR(p_hwfn->cdev, "DPC called - no p_sp_sb\n");255 DP_ERR(p_hwfn->cdev, "DPC called - no p_sp_sb\n");
261 return;256 return;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+2−1
@@ -353,7 +353,8 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) · 352 unmodified lines
353 if (!is_valid_ether_addr(addr->sa_data))353 if (!is_valid_ether_addr(addr->sa_data))
354 return -EINVAL;354 return -EINVAL;
355 355
356 if (ether_addr_equal_unaligned(adapter->mac_addr, addr->sa_data))356 if (ether_addr_equal_unaligned(adapter->mac_addr, addr->sa_data) &&
357 ether_addr_equal_unaligned(netdev->dev_addr, addr->sa_data))
357 return 0;358 return 0;
358 359
359 if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) {360 if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
drivers/net/ethernet/renesas/sh_eth.c+30−54
@@ -1098,7 +1098,7 @@ static struct mdiobb_ops bb_ops = { · 1097 unmodified lines
1098static void sh_eth_ring_free(struct net_device *ndev)1098static void sh_eth_ring_free(struct net_device *ndev)
1099{1099{
1100 struct sh_eth_private *mdp = netdev_priv(ndev);1100 struct sh_eth_private *mdp = netdev_priv(ndev);
1101 int i;1101 int ringsize, i;
1102 1102
1103 /* Free Rx skb ringbuffer */1103 /* Free Rx skb ringbuffer */
1104 if (mdp->rx_skbuff) {1104 if (mdp->rx_skbuff) {
@@ -1115,6 +1115,20 @@ static void sh_eth_ring_free(struct net_device *ndev) · 10 unmodified lines
1115 }1115 }
1116 kfree(mdp->tx_skbuff);1116 kfree(mdp->tx_skbuff);
1117 mdp->tx_skbuff = NULL;1117 mdp->tx_skbuff = NULL;
1118
1119 if (mdp->rx_ring) {
1120 ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
1121 dma_free_coherent(NULL, ringsize, mdp->rx_ring,
1122 mdp->rx_desc_dma);
1123 mdp->rx_ring = NULL;
1124 }
1125
1126 if (mdp->tx_ring) {
1127 ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
1128 dma_free_coherent(NULL, ringsize, mdp->tx_ring,
1129 mdp->tx_desc_dma);
1130 mdp->tx_ring = NULL;
1131 }
1118}1132}
1119 1133
1120/* format skb and descriptor buffer */1134/* format skb and descriptor buffer */
@@ -1199,7 +1213,7 @@ static void sh_eth_ring_format(struct net_device *ndev) · 78 unmodified lines
1199static int sh_eth_ring_init(struct net_device *ndev)1213static int sh_eth_ring_init(struct net_device *ndev)
1200{1214{
1201 struct sh_eth_private *mdp = netdev_priv(ndev);1215 struct sh_eth_private *mdp = netdev_priv(ndev);
1202 int rx_ringsize, tx_ringsize, ret = 0;1216 int rx_ringsize, tx_ringsize;
1203 1217
1204 /* +26 gets the maximum ethernet encapsulation, +7 & ~7 because the1218 /* +26 gets the maximum ethernet encapsulation, +7 & ~7 because the
1205 * card needs room to do 8 byte alignment, +2 so we can reserve1219 * card needs room to do 8 byte alignment, +2 so we can reserve
@@ -1214,26 +1228,20 @@ static int sh_eth_ring_init(struct net_device *ndev) · 8 unmodified lines
1214 /* Allocate RX and TX skb rings */1228 /* Allocate RX and TX skb rings */
1215 mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff),1229 mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff),
1216 GFP_KERNEL);1230 GFP_KERNEL);
1217 if (!mdp->rx_skbuff) {1231 if (!mdp->rx_skbuff)
1218 ret = -ENOMEM;1232 return -ENOMEM;
1219 return ret;
1220 }
1221 1233
1222 mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff),1234 mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff),
1223 GFP_KERNEL);1235 GFP_KERNEL);
1224 if (!mdp->tx_skbuff) {1236 if (!mdp->tx_skbuff)
1225 ret = -ENOMEM;1237 goto ring_free;
1226 goto skb_ring_free;
1227 }
1228 1238
1229 /* Allocate all Rx descriptors. */1239 /* Allocate all Rx descriptors. */
1230 rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;1240 rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
1231 mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma,1241 mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma,
1232 GFP_KERNEL);1242 GFP_KERNEL);
1233 if (!mdp->rx_ring) {1243 if (!mdp->rx_ring)
1234 ret = -ENOMEM;1244 goto ring_free;
1235 goto skb_ring_free;
1236 }
1237 1245
1238 mdp->dirty_rx = 0;1246 mdp->dirty_rx = 0;
1239 1247
@@ -1241,42 +1249,15 @@ static int sh_eth_ring_init(struct net_device *ndev) · 1 unmodified line
1241 tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;1249 tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
1242 mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma,1250 mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma,
1243 GFP_KERNEL);1251 GFP_KERNEL);
1244 if (!mdp->tx_ring) {1252 if (!mdp->tx_ring)
1245 ret = -ENOMEM;1253 goto ring_free;
1246 goto desc_ring_free;1254 return 0;
1247 }
1248 return ret;
1249
1250desc_ring_free:
1251 /* free DMA buffer */
1252 dma_free_coherent(NULL, rx_ringsize, mdp->rx_ring, mdp->rx_desc_dma);
1253 1255
1254skb_ring_free:1256ring_free:
1255 /* Free Rx and Tx skb ring buffer */1257 /* Free Rx and Tx skb ring buffer and DMA buffer */
1256 sh_eth_ring_free(ndev);1258 sh_eth_ring_free(ndev);
1257 mdp->tx_ring = NULL;
1258 mdp->rx_ring = NULL;
1259
1260 return ret;
1261}
1262
1263static void sh_eth_free_dma_buffer(struct sh_eth_private *mdp)
1264{
1265 int ringsize;
1266
1267 if (mdp->rx_ring) {
1268 ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
1269 dma_free_coherent(NULL, ringsize, mdp->rx_ring,
1270 mdp->rx_desc_dma);
1271 mdp->rx_ring = NULL;
1272 }
1273 1259
1274 if (mdp->tx_ring) {1260 return -ENOMEM;
1275 ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
1276 dma_free_coherent(NULL, ringsize, mdp->tx_ring,
1277 mdp->tx_desc_dma);
1278 mdp->tx_ring = NULL;
1279 }
1280}1261}
1281 1262
1282static int sh_eth_dev_init(struct net_device *ndev, bool start)1263static int sh_eth_dev_init(struct net_device *ndev, bool start)
@@ -2239,10 +2220,8 @@ static int sh_eth_set_ringparam(struct net_device *ndev, · 956 unmodified lines
2239 2220
2240 sh_eth_dev_exit(ndev);2221 sh_eth_dev_exit(ndev);
2241 2222
2242 /* Free all the skbuffs in the Rx queue. */2223 /* Free all the skbuffs in the Rx queue and the DMA buffers. */
2243 sh_eth_ring_free(ndev);2224 sh_eth_ring_free(ndev);
2244 /* Free DMA buffer */
2245 sh_eth_free_dma_buffer(mdp);
2246 }2225 }
2247 2226
2248 /* Set new parameters */2227 /* Set new parameters */
@@ -2487,12 +2466,9 @@ static int sh_eth_close(struct net_device *ndev) · 238 unmodified lines
2487 2466
2488 free_irq(ndev->irq, ndev);2467 free_irq(ndev->irq, ndev);
2489 2468
2490 /* Free all the skbuffs in the Rx queue. */2469 /* Free all the skbuffs in the Rx queue and the DMA buffer. */
2491 sh_eth_ring_free(ndev);2470 sh_eth_ring_free(ndev);
2492 2471
2493 /* free DMA buffer */
2494 sh_eth_free_dma_buffer(mdp);
2495
2496 pm_runtime_put_sync(&mdp->pdev->dev);2472 pm_runtime_put_sync(&mdp->pdev->dev);
2497 2473
2498 mdp->is_opened = 0;2474 mdp->is_opened = 0;
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c+1−1
@@ -354,7 +354,7 @@ static int gmac_clk_init(struct rk_priv_data *bsp_priv) · 353 unmodified lines
354 354
355static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)355static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
356{356{
357 int phy_iface = phy_iface = bsp_priv->phy_iface;357 int phy_iface = bsp_priv->phy_iface;
358 358
359 if (enable) {359 if (enable) {
360 if (!bsp_priv->clk_enabled) {360 if (!bsp_priv->clk_enabled) {
drivers/net/ethernet/synopsys/dwc_eth_qos.c+1−2
@@ -2970,8 +2970,7 @@ err_out_unregister_netdev: · 2969 unmodified lines
2970err_out_clk_dis_aper:2970err_out_clk_dis_aper:
2971 clk_disable_unprepare(lp->apb_pclk);2971 clk_disable_unprepare(lp->apb_pclk);
2972err_out_free_netdev:2972err_out_free_netdev:
2973 if (lp->phy_node)2973 of_node_put(lp->phy_node);
2974 of_node_put(lp->phy_node);
2975 free_netdev(ndev);2974 free_netdev(ndev);
2976 platform_set_drvdata(pdev, NULL);2975 platform_set_drvdata(pdev, NULL);
2977 return ret;2976 return ret;
drivers/net/ethernet/ti/cpsw.c+13−0
@@ -2037,6 +2037,19 @@ static int cpsw_probe_dt(struct cpsw_priv *priv, · 2036 unmodified lines
2037 continue;2037 continue;
2038 2038
2039 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);2039 priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
2040 if (of_phy_is_fixed_link(slave_node)) {
2041 struct phy_device *pd;
2042
2043 ret = of_phy_register_fixed_link(slave_node);
2044 if (ret)
2045 return ret;
2046 pd = of_phy_find_device(slave_node);
2047 if (!pd)
2048 return -ENODEV;
2049 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2050 PHY_ID_FMT, pd->bus->id, pd->phy_id);
2051 goto no_phy_slave;
2052 }
2040 parp = of_get_property(slave_node, "phy_id", &lenp);2053 parp = of_get_property(slave_node, "phy_id", &lenp);
2041 if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {2054 if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
2042 dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);2055 dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i);
drivers/net/fjes/fjes_hw.c+1−3
@@ -143,9 +143,7 @@ static int fjes_hw_alloc_epbuf(struct epbuf_handler *epbh) · 142 unmodified lines
143 143
144static void fjes_hw_free_epbuf(struct epbuf_handler *epbh)144static void fjes_hw_free_epbuf(struct epbuf_handler *epbh)
145{145{
146 if (epbh->buffer)146 vfree(epbh->buffer);
147 vfree(epbh->buffer);
148
149 epbh->buffer = NULL;147 epbh->buffer = NULL;
150 epbh->size = 0;148 epbh->size = 0;
151 149
drivers/net/macvtap.c+3−2
@@ -935,6 +935,9 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, · 934 unmodified lines
935 /* Nothing to read, let's sleep */935 /* Nothing to read, let's sleep */
936 schedule();936 schedule();
937 }937 }
938 if (!noblock)
939 finish_wait(sk_sleep(&q->sk), &wait);
940
938 if (skb) {941 if (skb) {
939 ret = macvtap_put_user(q, skb, to);942 ret = macvtap_put_user(q, skb, to);
940 if (unlikely(ret < 0))943 if (unlikely(ret < 0))
@@ -942,8 +945,6 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, · 1 unmodified line
942 else945 else
943 consume_skb(skb);946 consume_skb(skb);
944 }947 }
945 if (!noblock)
946 finish_wait(sk_sleep(&q->sk), &wait);
947 return ret;948 return ret;
948}949}
949 950
drivers/net/usb/qmi_wwan.c+21−0
@@ -771,6 +771,7 @@ static const struct usb_device_id products[] = { · 770 unmodified lines
771 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */771 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
772 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */772 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
773 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */773 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
774 {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */
774 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */775 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
775 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */776 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
776 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */777 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
@@ -802,10 +803,24 @@ static const struct usb_device_id products[] = { · 25 unmodified lines
802};803};
803MODULE_DEVICE_TABLE(usb, products);804MODULE_DEVICE_TABLE(usb, products);
804 805
806static bool quectel_ec20_detected(struct usb_interface *intf)
807{
808 struct usb_device *dev = interface_to_usbdev(intf);
809
810 if (dev->actconfig &&
811 le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 &&
812 le16_to_cpu(dev->descriptor.idProduct) == 0x9215 &&
813 dev->actconfig->desc.bNumInterfaces == 5)
814 return true;
815
816 return false;
817}
818
805static int qmi_wwan_probe(struct usb_interface *intf,819static int qmi_wwan_probe(struct usb_interface *intf,
806 const struct usb_device_id *prod)820 const struct usb_device_id *prod)
807{821{
808 struct usb_device_id *id = (struct usb_device_id *)prod;822 struct usb_device_id *id = (struct usb_device_id *)prod;
823 struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
809 824
810 /* Workaround to enable dynamic IDs. This disables usbnet825 /* Workaround to enable dynamic IDs. This disables usbnet
811 * blacklisting functionality. Which, if required, can be826 * blacklisting functionality. Which, if required, can be
@@ -817,6 +832,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, · 5 unmodified lines
817 id->driver_info = (unsigned long)&qmi_wwan_info;832 id->driver_info = (unsigned long)&qmi_wwan_info;
818 }833 }
819 834
835 /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */
836 if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) {
837 dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n");
838 return -ENODEV;
839 }
840
820 return usbnet_probe(intf, id);841 return usbnet_probe(intf, id);
821}842}
822 843
drivers/nfc/nfcmrvl/Kconfig+1−1
@@ -44,7 +44,7 @@ config NFC_MRVL_I2C · 43 unmodified lines
44 44
45config NFC_MRVL_SPI45config NFC_MRVL_SPI
46 tristate "Marvell NFC-over-SPI driver"46 tristate "Marvell NFC-over-SPI driver"
47 depends on NFC_MRVL && SPI47 depends on NFC_MRVL && NFC_NCI_SPI
48 help48 help
49 Marvell NFC-over-SPI driver.49 Marvell NFC-over-SPI driver.
50 50
drivers/nfc/nfcmrvl/fw_dnld.c+9−3
@@ -113,9 +113,12 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error) · 112 unmodified lines
113 }113 }
114 114
115 atomic_set(&priv->ndev->cmd_cnt, 0);115 atomic_set(&priv->ndev->cmd_cnt, 0);
116 del_timer_sync(&priv->ndev->cmd_timer);
117 116
118 del_timer_sync(&priv->fw_dnld.timer);117 if (timer_pending(&priv->ndev->cmd_timer))
118 del_timer_sync(&priv->ndev->cmd_timer);
119
120 if (timer_pending(&priv->fw_dnld.timer))
121 del_timer_sync(&priv->fw_dnld.timer);
119 122
120 nfc_info(priv->dev, "FW loading over (%d)]\n", error);123 nfc_info(priv->dev, "FW loading over (%d)]\n", error);
121 124
@@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv) · 350 unmodified lines
472void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,475void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
473 struct sk_buff *skb)476 struct sk_buff *skb)
474{477{
478 /* Discard command timer */
479 if (timer_pending(&priv->ndev->cmd_timer))
480 del_timer_sync(&priv->ndev->cmd_timer);
481
475 /* Allow next command */482 /* Allow next command */
476 atomic_set(&priv->ndev->cmd_cnt, 1);483 atomic_set(&priv->ndev->cmd_cnt, 1);
477 del_timer_sync(&priv->ndev->cmd_timer);
478 484
479 /* Queue and trigger rx work */485 /* Queue and trigger rx work */
480 skb_queue_tail(&priv->fw_dnld.rx_q, skb);486 skb_queue_tail(&priv->fw_dnld.rx_q, skb);
drivers/nfc/nfcmrvl/main.c+3−12
@@ -194,6 +194,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv) · 193 unmodified lines
194 194
195 nfcmrvl_fw_dnld_deinit(priv);195 nfcmrvl_fw_dnld_deinit(priv);
196 196
197 if (priv->config.reset_n_io)
198 devm_gpio_free(priv->dev, priv->config.reset_n_io);
199
197 nci_unregister_device(ndev);200 nci_unregister_device(ndev);
198 nci_free_device(ndev);201 nci_free_device(ndev);
199 kfree(priv);202 kfree(priv);
@@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv) · 51 unmodified lines
251 gpio_set_value(priv->config.reset_n_io, 0);254 gpio_set_value(priv->config.reset_n_io, 0);
252}255}
253 256
254#ifdef CONFIG_OF
255
256int nfcmrvl_parse_dt(struct device_node *node,257int nfcmrvl_parse_dt(struct device_node *node,
257 struct nfcmrvl_platform_data *pdata)258 struct nfcmrvl_platform_data *pdata)
258{259{
@@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node, · 16 unmodified lines
275 276
276 return 0;277 return 0;
277}278}
278
279#else
280
281int nfcmrvl_parse_dt(struct device_node *node,
282 struct nfcmrvl_platform_data *pdata)
283{
284 return -ENODEV;
285}
286
287#endif
288EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);279EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);
289 280
290MODULE_AUTHOR("Marvell International Ltd.");281MODULE_AUTHOR("Marvell International Ltd.");
drivers/nfc/nfcmrvl/uart.c+9−17
@@ -67,8 +67,6 @@ static struct nfcmrvl_if_ops uart_ops = { · 66 unmodified lines
67 .nci_update_config = nfcmrvl_uart_nci_update_config67 .nci_update_config = nfcmrvl_uart_nci_update_config
68};68};
69 69
70#ifdef CONFIG_OF
71
72static int nfcmrvl_uart_parse_dt(struct device_node *node,70static int nfcmrvl_uart_parse_dt(struct device_node *node,
73 struct nfcmrvl_platform_data *pdata)71 struct nfcmrvl_platform_data *pdata)
74{72{
@@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node, · 27 unmodified lines
102 return 0;100 return 0;
103}101}
104 102
105#else
106
107static int nfcmrvl_uart_parse_dt(struct device_node *node,
108 struct nfcmrvl_platform_data *pdata)
109{
110 return -ENODEV;
111}
112
113#endif
114
115/*103/*
116** NCI UART OPS104** NCI UART OPS
117*/105*/
@@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu) · 34 unmodified lines
152 nu->drv_data = priv;140 nu->drv_data = priv;
153 nu->ndev = priv->ndev;141 nu->ndev = priv->ndev;
154 142
155 /* Set BREAK */
156 if (priv->config.break_control && nu->tty->ops->break_ctl)
157 nu->tty->ops->break_ctl(nu->tty, -1);
158
159 return 0;143 return 0;
160}144}
161 145
@@ -174,6 +158,9 @@ static void nfcmrvl_nci_uart_tx_start(struct nci_uart *nu) · 12 unmodified lines
174{158{
175 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;159 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
176 160
161 if (priv->ndev->nfc_dev->fw_download_in_progress)
162 return;
163
177 /* Remove BREAK to wake up the NFCC */164 /* Remove BREAK to wake up the NFCC */
178 if (priv->config.break_control && nu->tty->ops->break_ctl) {165 if (priv->config.break_control && nu->tty->ops->break_ctl) {
179 nu->tty->ops->break_ctl(nu->tty, 0);166 nu->tty->ops->break_ctl(nu->tty, 0);
@@ -185,13 +172,18 @@ static void nfcmrvl_nci_uart_tx_done(struct nci_uart *nu) · 5 unmodified lines
185{172{
186 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;173 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
187 174
175 if (priv->ndev->nfc_dev->fw_download_in_progress)
176 return;
177
188 /*178 /*
189 ** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him179 ** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him
190 ** up. we set BREAK. Once we will be ready to send again we will remove180 ** up. we set BREAK. Once we will be ready to send again we will remove
191 ** it.181 ** it.
192 */182 */
193 if (priv->config.break_control && nu->tty->ops->break_ctl)183 if (priv->config.break_control && nu->tty->ops->break_ctl) {
194 nu->tty->ops->break_ctl(nu->tty, -1);184 nu->tty->ops->break_ctl(nu->tty, -1);
185 usleep_range(1000, 3000);
186 }
195}187}
196 188
197static struct nci_uart nfcmrvl_nci_uart = {189static struct nci_uart nfcmrvl_nci_uart = {
include/linux/netdevice.h+1−0
@@ -1322,6 +1322,7 @@ enum netdev_priv_flags { · 1321 unmodified lines
1322#define IFF_L3MDEV_MASTER IFF_L3MDEV_MASTER1322#define IFF_L3MDEV_MASTER IFF_L3MDEV_MASTER
1323#define IFF_NO_QUEUE IFF_NO_QUEUE1323#define IFF_NO_QUEUE IFF_NO_QUEUE
1324#define IFF_OPENVSWITCH IFF_OPENVSWITCH1324#define IFF_OPENVSWITCH IFF_OPENVSWITCH
1325#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE
1325 1326
1326/**1327/**
1327 * struct net_device - The DEVICE structure.1328 * struct net_device - The DEVICE structure.
include/linux/tcp.h+7−0
@@ -397,6 +397,13 @@ static inline void fastopen_queue_tune(struct sock *sk, int backlog) · 396 unmodified lines
397 queue->fastopenq.max_qlen = min_t(unsigned int, backlog, somaxconn);397 queue->fastopenq.max_qlen = min_t(unsigned int, backlog, somaxconn);
398}398}
399 399
400static inline void tcp_move_syn(struct tcp_sock *tp,
401 struct request_sock *req)
402{
403 tp->saved_syn = req->saved_syn;
404 req->saved_syn = NULL;
405}
406
400static inline void tcp_saved_syn_free(struct tcp_sock *tp)407static inline void tcp_saved_syn_free(struct tcp_sock *tp)
401{408{
402 kfree(tp->saved_syn);409 kfree(tp->saved_syn);
include/net/bluetooth/l2cap.h+2−0
@@ -275,6 +275,8 @@ struct l2cap_conn_rsp { · 274 unmodified lines
275#define L2CAP_CR_AUTHORIZATION 0x0006275#define L2CAP_CR_AUTHORIZATION 0x0006
276#define L2CAP_CR_BAD_KEY_SIZE 0x0007276#define L2CAP_CR_BAD_KEY_SIZE 0x0007
277#define L2CAP_CR_ENCRYPTION 0x0008277#define L2CAP_CR_ENCRYPTION 0x0008
278#define L2CAP_CR_INVALID_SCID 0x0009
279#define L2CAP_CR_SCID_IN_USE 0x0010
278 280
279/* connect/create channel status */281/* connect/create channel status */
280#define L2CAP_CS_NO_INFO 0x0000282#define L2CAP_CS_NO_INFO 0x0000
include/net/dst_metadata.h+2−1
@@ -63,12 +63,13 @@ static inline struct metadata_dst *tun_rx_dst(int md_size) · 62 unmodified lines
63static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)63static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)
64{64{
65 struct metadata_dst *md_dst = skb_metadata_dst(skb);65 struct metadata_dst *md_dst = skb_metadata_dst(skb);
66 int md_size = md_dst->u.tun_info.options_len;66 int md_size;
67 struct metadata_dst *new_md;67 struct metadata_dst *new_md;
68 68
69 if (!md_dst)69 if (!md_dst)
70 return ERR_PTR(-EINVAL);70 return ERR_PTR(-EINVAL);
71 71
72 md_size = md_dst->u.tun_info.options_len;
72 new_md = metadata_dst_alloc(md_size, GFP_ATOMIC);73 new_md = metadata_dst_alloc(md_size, GFP_ATOMIC);
73 if (!new_md)74 if (!new_md)
74 return ERR_PTR(-ENOMEM);75 return ERR_PTR(-ENOMEM);
include/net/inet_sock.h+12−0
@@ -210,6 +210,18 @@ struct inet_sock { · 209 unmodified lines
210#define IP_CMSG_ORIGDSTADDR BIT(6)210#define IP_CMSG_ORIGDSTADDR BIT(6)
211#define IP_CMSG_CHECKSUM BIT(7)211#define IP_CMSG_CHECKSUM BIT(7)
212 212
213/* SYNACK messages might be attached to request sockets.
214 * Some places want to reach the listener in this case.
215 */
216static inline struct sock *skb_to_full_sk(const struct sk_buff *skb)
217{
218 struct sock *sk = skb->sk;
219
220 if (sk && sk->sk_state == TCP_NEW_SYN_RECV)
221 sk = inet_reqsk(sk)->rsk_listener;
222 return sk;
223}
224
213static inline struct inet_sock *inet_sk(const struct sock *sk)225static inline struct inet_sock *inet_sk(const struct sock *sk)
214{226{
215 return (struct inet_sock *)sk;227 return (struct inet_sock *)sk;
kernel/trace/Kconfig+1−1
@@ -434,7 +434,7 @@ config UPROBE_EVENT · 433 unmodified lines
434 434
435config BPF_EVENTS435config BPF_EVENTS
436 depends on BPF_SYSCALL436 depends on BPF_SYSCALL
437 depends on KPROBE_EVENT || UPROBE_EVENT437 depends on (KPROBE_EVENT || UPROBE_EVENT) && PERF_EVENTS
438 bool438 bool
439 default y439 default y
440 help440 help
lib/test_bpf.c+30−0
@@ -5055,6 +5055,36 @@ static struct bpf_test tests[] = { · 5054 unmodified lines
5055 {},5055 {},
5056 { {0x1, 0x0 } },5056 { {0x1, 0x0 } },
5057 },5057 },
5058 {
5059 "MOD default X",
5060 .u.insns = {
5061 /*
5062 * A = 0x42
5063 * A = A mod X ; this halt the filter execution if X is 0
5064 * ret 0x42
5065 */
5066 BPF_STMT(BPF_LD | BPF_IMM, 0x42),
5067 BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
5068 BPF_STMT(BPF_RET | BPF_K, 0x42),
5069 },
5070 CLASSIC | FLAG_NO_DATA,
5071 {},
5072 { {0x1, 0x0 } },
5073 },
5074 {
5075 "MOD default A",
5076 .u.insns = {
5077 /*
5078 * A = A mod 1
5079 * ret A
5080 */
5081 BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x1),
5082 BPF_STMT(BPF_RET | BPF_A, 0x0),
5083 },
5084 CLASSIC | FLAG_NO_DATA,
5085 {},
5086 { {0x1, 0x0 } },
5087 },
5058 {5088 {
5059 "JMP EQ default A",5089 "JMP EQ default A",
5060 .u.insns = {5090 .u.insns = {
net/bluetooth/hci_core.c+11−6
@@ -508,12 +508,6 @@ static void le_setup(struct hci_request *req) · 507 unmodified lines
508 /* Read LE Supported States */508 /* Read LE Supported States */
509 hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);509 hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);
510 510
511 /* Read LE White List Size */
512 hci_req_add(req, HCI_OP_LE_READ_WHITE_LIST_SIZE, 0, NULL);
513
514 /* Clear LE White List */
515 hci_req_add(req, HCI_OP_LE_CLEAR_WHITE_LIST, 0, NULL);
516
517 /* LE-only controllers have LE implicitly enabled */511 /* LE-only controllers have LE implicitly enabled */
518 if (!lmp_bredr_capable(hdev))512 if (!lmp_bredr_capable(hdev))
519 hci_dev_set_flag(hdev, HCI_LE_ENABLED);513 hci_dev_set_flag(hdev, HCI_LE_ENABLED);
@@ -832,6 +826,17 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) · 312 unmodified lines
832 hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);826 hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
833 }827 }
834 828
829 if (hdev->commands[26] & 0x40) {
830 /* Read LE White List Size */
831 hci_req_add(req, HCI_OP_LE_READ_WHITE_LIST_SIZE,
832 0, NULL);
833 }
834
835 if (hdev->commands[26] & 0x80) {
836 /* Clear LE White List */
837 hci_req_add(req, HCI_OP_LE_CLEAR_WHITE_LIST, 0, NULL);
838 }
839
835 if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) {840 if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) {
836 /* Read LE Maximum Data Length */841 /* Read LE Maximum Data Length */
837 hci_req_add(req, HCI_OP_LE_READ_MAX_DATA_LEN, 0, NULL);842 hci_req_add(req, HCI_OP_LE_READ_MAX_DATA_LEN, 0, NULL);
net/bluetooth/l2cap_core.c+17−3
@@ -239,7 +239,7 @@ static u16 l2cap_alloc_cid(struct l2cap_conn *conn) · 238 unmodified lines
239 else239 else
240 dyn_end = L2CAP_CID_DYN_END;240 dyn_end = L2CAP_CID_DYN_END;
241 241
242 for (cid = L2CAP_CID_DYN_START; cid < dyn_end; cid++) {242 for (cid = L2CAP_CID_DYN_START; cid <= dyn_end; cid++) {
243 if (!__l2cap_get_chan_by_scid(conn, cid))243 if (!__l2cap_get_chan_by_scid(conn, cid))
244 return cid;244 return cid;
245 }245 }
@@ -5250,7 +5250,9 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn, · 5004 unmodified lines
5250 credits = __le16_to_cpu(rsp->credits);5250 credits = __le16_to_cpu(rsp->credits);
5251 result = __le16_to_cpu(rsp->result);5251 result = __le16_to_cpu(rsp->result);
5252 5252
5253 if (result == L2CAP_CR_SUCCESS && (mtu < 23 || mps < 23))5253 if (result == L2CAP_CR_SUCCESS && (mtu < 23 || mps < 23 ||
5254 dcid < L2CAP_CID_DYN_START ||
5255 dcid > L2CAP_CID_LE_DYN_END))
5254 return -EPROTO;5256 return -EPROTO;
5255 5257
5256 BT_DBG("dcid 0x%4.4x mtu %u mps %u credits %u result 0x%2.2x",5258 BT_DBG("dcid 0x%4.4x mtu %u mps %u credits %u result 0x%2.2x",
@@ -5270,6 +5272,11 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn, · 13 unmodified lines
5270 5272
5271 switch (result) {5273 switch (result) {
5272 case L2CAP_CR_SUCCESS:5274 case L2CAP_CR_SUCCESS:
5275 if (__l2cap_get_chan_by_dcid(conn, dcid)) {
5276 err = -EBADSLT;
5277 break;
5278 }
5279
5273 chan->ident = 0;5280 chan->ident = 0;
5274 chan->dcid = dcid;5281 chan->dcid = dcid;
5275 chan->omtu = mtu;5282 chan->omtu = mtu;
@@ -5437,9 +5444,16 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, · 161 unmodified lines
5437 goto response_unlock;5444 goto response_unlock;
5438 }5445 }
5439 5446
5447 /* Check for valid dynamic CID range */
5448 if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) {
5449 result = L2CAP_CR_INVALID_SCID;
5450 chan = NULL;
5451 goto response_unlock;
5452 }
5453
5440 /* Check if we already have channel with that dcid */5454 /* Check if we already have channel with that dcid */
5441 if (__l2cap_get_chan_by_dcid(conn, scid)) {5455 if (__l2cap_get_chan_by_dcid(conn, scid)) {
5442 result = L2CAP_CR_NO_MEM;5456 result = L2CAP_CR_SCID_IN_USE;
5443 chan = NULL;5457 chan = NULL;
5444 goto response_unlock;5458 goto response_unlock;
5445 }5459 }
net/bridge/br_stp.c+9−4
@@ -600,12 +600,17 @@ void __br_set_forward_delay(struct net_bridge *br, unsigned long t) · 599 unmodified lines
600int br_set_forward_delay(struct net_bridge *br, unsigned long val)600int br_set_forward_delay(struct net_bridge *br, unsigned long val)
601{601{
602 unsigned long t = clock_t_to_jiffies(val);602 unsigned long t = clock_t_to_jiffies(val);
603 603 int err = -ERANGE;
604 if (t < BR_MIN_FORWARD_DELAY || t > BR_MAX_FORWARD_DELAY)
605 return -ERANGE;
606 604
607 spin_lock_bh(&br->lock);605 spin_lock_bh(&br->lock);
606 if (br->stp_enabled != BR_NO_STP &&
607 (t < BR_MIN_FORWARD_DELAY || t > BR_MAX_FORWARD_DELAY))
608 goto unlock;
609
608 __br_set_forward_delay(br, t);610 __br_set_forward_delay(br, t);
611 err = 0;
612
613unlock:
609 spin_unlock_bh(&br->lock);614 spin_unlock_bh(&br->lock);
610 return 0;615 return err;
611}616}
net/core/dev.c+4−3
@@ -6402,7 +6402,7 @@ int __netdev_update_features(struct net_device *dev) · 6401 unmodified lines
6402 struct net_device *upper, *lower;6402 struct net_device *upper, *lower;
6403 netdev_features_t features;6403 netdev_features_t features;
6404 struct list_head *iter;6404 struct list_head *iter;
6405 int err = 0;6405 int err = -1;
6406 6406
6407 ASSERT_RTNL();6407 ASSERT_RTNL();
6408 6408
@@ -6419,7 +6419,7 @@ int __netdev_update_features(struct net_device *dev) · 10 unmodified lines
6419 features = netdev_sync_upper_features(dev, upper, features);6419 features = netdev_sync_upper_features(dev, upper, features);
6420 6420
6421 if (dev->features == features)6421 if (dev->features == features)
6422 return 0;6422 goto sync_lower;
6423 6423
6424 netdev_dbg(dev, "Features changed: %pNF -> %pNF\n",6424 netdev_dbg(dev, "Features changed: %pNF -> %pNF\n",
6425 &dev->features, &features);6425 &dev->features, &features);
@@ -6434,6 +6434,7 @@ int __netdev_update_features(struct net_device *dev) · 8 unmodified lines
6434 return -1;6434 return -1;
6435 }6435 }
6436 6436
6437sync_lower:
6437 /* some features must be disabled on lower devices when disabled6438 /* some features must be disabled on lower devices when disabled
6438 * on an upper device (think: bonding master or bridge)6439 * on an upper device (think: bonding master or bridge)
6439 */6440 */
@@ -6443,7 +6444,7 @@ int __netdev_update_features(struct net_device *dev) · 3 unmodified lines
6443 if (!err)6444 if (!err)
6444 dev->features = features;6445 dev->features = features;
6445 6446
6446 return 1;6447 return err < 0 ? 0 : 1;
6447}6448}
6448 6449
6449/**6450/**
net/core/dst.c+1−1
@@ -306,7 +306,7 @@ void dst_release(struct dst_entry *dst) · 305 unmodified lines
306 if (unlikely(newrefcnt < 0))306 if (unlikely(newrefcnt < 0))
307 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",307 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
308 __func__, dst, newrefcnt);308 __func__, dst, newrefcnt);
309 if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)309 if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE))
310 call_rcu(&dst->rcu_head, dst_destroy_rcu);310 call_rcu(&dst->rcu_head, dst_destroy_rcu);
311 }311 }
312}312}
net/ipv4/fib_semantics.c+10−3
@@ -923,14 +923,21 @@ static bool fib_valid_prefsrc(struct fib_config *cfg, __be32 fib_prefsrc) · 922 unmodified lines
923 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||923 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
924 fib_prefsrc != cfg->fc_dst) {924 fib_prefsrc != cfg->fc_dst) {
925 u32 tb_id = cfg->fc_table;925 u32 tb_id = cfg->fc_table;
926 int rc;
926 927
927 if (tb_id == RT_TABLE_MAIN)928 if (tb_id == RT_TABLE_MAIN)
928 tb_id = RT_TABLE_LOCAL;929 tb_id = RT_TABLE_LOCAL;
929 930
930 if (inet_addr_type_table(cfg->fc_nlinfo.nl_net,931 rc = inet_addr_type_table(cfg->fc_nlinfo.nl_net,
931 fib_prefsrc, tb_id) != RTN_LOCAL) {932 fib_prefsrc, tb_id);
932 return false;933
934 if (rc != RTN_LOCAL && tb_id != RT_TABLE_LOCAL) {
935 rc = inet_addr_type_table(cfg->fc_nlinfo.nl_net,
936 fib_prefsrc, RT_TABLE_LOCAL);
933 }937 }
938
939 if (rc != RTN_LOCAL)
940 return false;
934 }941 }
935 return true;942 return true;
936}943}
net/ipv4/igmp.c+4−8
@@ -2392,11 +2392,11 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, · 2391 unmodified lines
2392 struct ip_sf_socklist *psl;2392 struct ip_sf_socklist *psl;
2393 struct net *net = sock_net(sk);2393 struct net *net = sock_net(sk);
2394 2394
2395 ASSERT_RTNL();
2396
2395 if (!ipv4_is_multicast(addr))2397 if (!ipv4_is_multicast(addr))
2396 return -EINVAL;2398 return -EINVAL;
2397 2399
2398 rtnl_lock();
2399
2400 imr.imr_multiaddr.s_addr = msf->imsf_multiaddr;2400 imr.imr_multiaddr.s_addr = msf->imsf_multiaddr;
2401 imr.imr_address.s_addr = msf->imsf_interface;2401 imr.imr_address.s_addr = msf->imsf_interface;
2402 imr.imr_ifindex = 0;2402 imr.imr_ifindex = 0;
@@ -2417,7 +2417,6 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, · 14 unmodified lines
2417 goto done;2417 goto done;
2418 msf->imsf_fmode = pmc->sfmode;2418 msf->imsf_fmode = pmc->sfmode;
2419 psl = rtnl_dereference(pmc->sflist);2419 psl = rtnl_dereference(pmc->sflist);
2420 rtnl_unlock();
2421 if (!psl) {2420 if (!psl) {
2422 len = 0;2421 len = 0;
2423 count = 0;2422 count = 0;
@@ -2436,7 +2435,6 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, · 12 unmodified lines
2436 return -EFAULT;2435 return -EFAULT;
2437 return 0;2436 return 0;
2438done:2437done:
2439 rtnl_unlock();
2440 return err;2438 return err;
2441}2439}
2442 2440
@@ -2450,6 +2448,8 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 7 unmodified lines
2450 struct inet_sock *inet = inet_sk(sk);2448 struct inet_sock *inet = inet_sk(sk);
2451 struct ip_sf_socklist *psl;2449 struct ip_sf_socklist *psl;
2452 2450
2451 ASSERT_RTNL();
2452
2453 psin = (struct sockaddr_in *)&gsf->gf_group;2453 psin = (struct sockaddr_in *)&gsf->gf_group;
2454 if (psin->sin_family != AF_INET)2454 if (psin->sin_family != AF_INET)
2455 return -EINVAL;2455 return -EINVAL;
@@ -2457,8 +2457,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 1 unmodified line
2457 if (!ipv4_is_multicast(addr))2457 if (!ipv4_is_multicast(addr))
2458 return -EINVAL;2458 return -EINVAL;
2459 2459
2460 rtnl_lock();
2461
2462 err = -EADDRNOTAVAIL;2460 err = -EADDRNOTAVAIL;
2463 2461
2464 for_each_pmc_rtnl(inet, pmc) {2462 for_each_pmc_rtnl(inet, pmc) {
@@ -2470,7 +2468,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 5 unmodified lines
2470 goto done;2468 goto done;
2471 gsf->gf_fmode = pmc->sfmode;2469 gsf->gf_fmode = pmc->sfmode;
2472 psl = rtnl_dereference(pmc->sflist);2470 psl = rtnl_dereference(pmc->sflist);
2473 rtnl_unlock();
2474 count = psl ? psl->sl_count : 0;2471 count = psl ? psl->sl_count : 0;
2475 copycount = count < gsf->gf_numsrc ? count : gsf->gf_numsrc;2472 copycount = count < gsf->gf_numsrc ? count : gsf->gf_numsrc;
2476 gsf->gf_numsrc = count;2473 gsf->gf_numsrc = count;
@@ -2490,7 +2487,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 13 unmodified lines
2490 }2487 }
2491 return 0;2488 return 0;
2492done:2489done:
2493 rtnl_unlock();
2494 return err;2490 return err;
2495}2491}
2496 2492
net/ipv4/ip_sockglue.c+30−15
@@ -1251,11 +1251,22 @@ EXPORT_SYMBOL(compat_ip_setsockopt); · 1250 unmodified lines
1251 * the _received_ ones. The set sets the _sent_ ones.1251 * the _received_ ones. The set sets the _sent_ ones.
1252 */1252 */
1253 1253
1254static bool getsockopt_needs_rtnl(int optname)
1255{
1256 switch (optname) {
1257 case IP_MSFILTER:
1258 case MCAST_MSFILTER:
1259 return true;
1260 }
1261 return false;
1262}
1263
1254static int do_ip_getsockopt(struct sock *sk, int level, int optname,1264static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1255 char __user *optval, int __user *optlen, unsigned int flags)1265 char __user *optval, int __user *optlen, unsigned int flags)
1256{1266{
1257 struct inet_sock *inet = inet_sk(sk);1267 struct inet_sock *inet = inet_sk(sk);
1258 int val;1268 bool needs_rtnl = getsockopt_needs_rtnl(optname);
1269 int val, err = 0;
1259 int len;1270 int len;
1260 1271
1261 if (level != SOL_IP)1272 if (level != SOL_IP)
@@ -1269,6 +1280,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, · 7 unmodified lines
1269 if (len < 0)1280 if (len < 0)
1270 return -EINVAL;1281 return -EINVAL;
1271 1282
1283 if (needs_rtnl)
1284 rtnl_lock();
1272 lock_sock(sk);1285 lock_sock(sk);
1273 1286
1274 switch (optname) {1287 switch (optname) {
@@ -1386,39 +1399,35 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, · 111 unmodified lines
1386 case IP_MSFILTER:1399 case IP_MSFILTER:
1387 {1400 {
1388 struct ip_msfilter msf;1401 struct ip_msfilter msf;
1389 int err;
1390 1402
1391 if (len < IP_MSFILTER_SIZE(0)) {1403 if (len < IP_MSFILTER_SIZE(0)) {
1392 release_sock(sk);1404 err = -EINVAL;
1393 return -EINVAL;1405 goto out;
1394 }1406 }
1395 if (copy_from_user(&msf, optval, IP_MSFILTER_SIZE(0))) {1407 if (copy_from_user(&msf, optval, IP_MSFILTER_SIZE(0))) {
1396 release_sock(sk);1408 err = -EFAULT;
1397 return -EFAULT;1409 goto out;
1398 }1410 }
1399 err = ip_mc_msfget(sk, &msf,1411 err = ip_mc_msfget(sk, &msf,
1400 (struct ip_msfilter __user *)optval, optlen);1412 (struct ip_msfilter __user *)optval, optlen);
1401 release_sock(sk);1413 goto out;
1402 return err;
1403 }1414 }
1404 case MCAST_MSFILTER:1415 case MCAST_MSFILTER:
1405 {1416 {
1406 struct group_filter gsf;1417 struct group_filter gsf;
1407 int err;
1408 1418
1409 if (len < GROUP_FILTER_SIZE(0)) {1419 if (len < GROUP_FILTER_SIZE(0)) {
1410 release_sock(sk);1420 err = -EINVAL;
1411 return -EINVAL;1421 goto out;
1412 }1422 }
1413 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) {1423 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) {
1414 release_sock(sk);1424 err = -EFAULT;
1415 return -EFAULT;1425 goto out;
1416 }1426 }
1417 err = ip_mc_gsfget(sk, &gsf,1427 err = ip_mc_gsfget(sk, &gsf,
1418 (struct group_filter __user *)optval,1428 (struct group_filter __user *)optval,
1419 optlen);1429 optlen);
1420 release_sock(sk);1430 goto out;
1421 return err;
1422 }1431 }
1423 case IP_MULTICAST_ALL:1432 case IP_MULTICAST_ALL:
1424 val = inet->mc_all;1433 val = inet->mc_all;
@@ -1485,6 +1494,12 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, · 60 unmodified lines
1485 return -EFAULT;1494 return -EFAULT;
1486 }1495 }
1487 return 0;1496 return 0;
1497
1498out:
1499 release_sock(sk);
1500 if (needs_rtnl)
1501 rtnl_unlock();
1502 return err;
1488}1503}
1489 1504
1490int ip_getsockopt(struct sock *sk, int level,1505int ip_getsockopt(struct sock *sk, int level,
net/ipv4/netfilter/nf_defrag_ipv4.c+2−3
@@ -67,10 +67,9 @@ static unsigned int ipv4_conntrack_defrag(void *priv, · 66 unmodified lines
67 const struct nf_hook_state *state)67 const struct nf_hook_state *state)
68{68{
69 struct sock *sk = skb->sk;69 struct sock *sk = skb->sk;
70 struct inet_sock *inet = inet_sk(skb->sk);
71 70
72 if (sk && (sk->sk_family == PF_INET) &&71 if (sk && sk_fullsock(sk) && (sk->sk_family == PF_INET) &&
73 inet->nodefrag)72 inet_sk(sk)->nodefrag)
74 return NF_ACCEPT;73 return NF_ACCEPT;
75 74
76#if IS_ENABLED(CONFIG_NF_CONNTRACK)75#if IS_ENABLED(CONFIG_NF_CONNTRACK)
net/ipv4/sysctl_net_ipv4.c+2−2
@@ -48,14 +48,14 @@ static void set_local_port_range(struct net *net, int range[2]) · 47 unmodified lines
48{48{
49 bool same_parity = !((range[0] ^ range[1]) & 1);49 bool same_parity = !((range[0] ^ range[1]) & 1);
50 50
51 write_seqlock(&net->ipv4.ip_local_ports.lock);51 write_seqlock_bh(&net->ipv4.ip_local_ports.lock);
52 if (same_parity && !net->ipv4.ip_local_ports.warned) {52 if (same_parity && !net->ipv4.ip_local_ports.warned) {
53 net->ipv4.ip_local_ports.warned = true;53 net->ipv4.ip_local_ports.warned = true;
54 pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n");54 pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n");
55 }55 }
56 net->ipv4.ip_local_ports.range[0] = range[0];56 net->ipv4.ip_local_ports.range[0] = range[0];
57 net->ipv4.ip_local_ports.range[1] = range[1];57 net->ipv4.ip_local_ports.range[1] = range[1];
58 write_sequnlock(&net->ipv4.ip_local_ports.lock);58 write_sequnlock_bh(&net->ipv4.ip_local_ports.lock);
59}59}
60 60
61/* Validate changes from /proc interface. */61/* Validate changes from /proc interface. */
net/ipv4/tcp_ipv4.c+2−0
@@ -1326,6 +1326,8 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, · 1325 unmodified lines
1326 if (__inet_inherit_port(sk, newsk) < 0)1326 if (__inet_inherit_port(sk, newsk) < 0)
1327 goto put_and_exit;1327 goto put_and_exit;
1328 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));1328 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
1329 if (*own_req)
1330 tcp_move_syn(newtp, req);
1329 1331
1330 return newsk;1332 return newsk;
1331 1333
net/ipv4/tcp_minisocks.c+0−3
@@ -551,9 +551,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 550 unmodified lines
551 newtp->rack.mstamp.v64 = 0;551 newtp->rack.mstamp.v64 = 0;
552 newtp->rack.advanced = 0;552 newtp->rack.advanced = 0;
553 553
554 newtp->saved_syn = req->saved_syn;
555 req->saved_syn = NULL;
556
557 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS);554 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS);
558 }555 }
559 return newsk;556 return newsk;
net/ipv6/addrconf.c+1−0
@@ -418,6 +418,7 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) · 417 unmodified lines
418 if (err) {418 if (err) {
419 ipv6_mc_destroy_dev(ndev);419 ipv6_mc_destroy_dev(ndev);
420 del_timer(&ndev->regen_timer);420 del_timer(&ndev->regen_timer);
421 snmp6_unregister_dev(ndev);
421 goto err_release;422 goto err_release;
422 }423 }
423 /* protected by rtnl_lock */424 /* protected by rtnl_lock */
net/ipv6/tcp_ipv6.c+12−8
@@ -1140,14 +1140,18 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * · 1139 unmodified lines
1140 goto out;1140 goto out;
1141 }1141 }
1142 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));1142 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
1143 /* Clone pktoptions received with SYN, if we own the req */1143 if (*own_req) {
1144 if (*own_req && ireq->pktopts) {1144 tcp_move_syn(newtp, req);
1145 newnp->pktoptions = skb_clone(ireq->pktopts,1145
1146 sk_gfp_atomic(sk, GFP_ATOMIC));1146 /* Clone pktoptions received with SYN, if we own the req */
1147 consume_skb(ireq->pktopts);1147 if (ireq->pktopts) {
1148 ireq->pktopts = NULL;1148 newnp->pktoptions = skb_clone(ireq->pktopts,
1149 if (newnp->pktoptions)1149 sk_gfp_atomic(sk, GFP_ATOMIC));
1150 skb_set_owner_r(newnp->pktoptions, newsk);1150 consume_skb(ireq->pktopts);
1151 ireq->pktopts = NULL;
1152 if (newnp->pktoptions)
1153 skb_set_owner_r(newnp->pktoptions, newsk);
1154 }
1151 }1155 }
1152 1156
1153 return newsk;1157 return newsk;
net/netfilter/nf_nat_redirect.c+1−1
@@ -55,7 +55,7 @@ nf_nat_redirect_ipv4(struct sk_buff *skb, · 54 unmodified lines
55 55
56 rcu_read_lock();56 rcu_read_lock();
57 indev = __in_dev_get_rcu(skb->dev);57 indev = __in_dev_get_rcu(skb->dev);
58 if (indev != NULL) {58 if (indev && indev->ifa_list) {
59 ifa = indev->ifa_list;59 ifa = indev->ifa_list;
60 newdst = ifa->ifa_local;60 newdst = ifa->ifa_local;
61 }61 }
net/netfilter/nfnetlink.c+1−1
@@ -492,7 +492,7 @@ static int nfnetlink_bind(struct net *net, int group) · 491 unmodified lines
492 type = nfnl_group2type[group];492 type = nfnl_group2type[group];
493 493
494 rcu_read_lock();494 rcu_read_lock();
495 ss = nfnetlink_get_subsys(type);495 ss = nfnetlink_get_subsys(type << 8);
496 rcu_read_unlock();496 rcu_read_unlock();
497 if (!ss)497 if (!ss)
498 request_module("nfnetlink-subsys-%d", type);498 request_module("nfnetlink-subsys-%d", type);
net/netfilter/nft_meta.c+20−16
@@ -31,6 +31,7 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 30 unmodified lines
31 const struct nft_meta *priv = nft_expr_priv(expr);31 const struct nft_meta *priv = nft_expr_priv(expr);
32 const struct sk_buff *skb = pkt->skb;32 const struct sk_buff *skb = pkt->skb;
33 const struct net_device *in = pkt->in, *out = pkt->out;33 const struct net_device *in = pkt->in, *out = pkt->out;
34 struct sock *sk;
34 u32 *dest = &regs->data[priv->dreg];35 u32 *dest = &regs->data[priv->dreg];
35 36
36 switch (priv->key) {37 switch (priv->key) {
@@ -86,33 +87,35 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 49 unmodified lines
86 *(u16 *)dest = out->type;87 *(u16 *)dest = out->type;
87 break;88 break;
88 case NFT_META_SKUID:89 case NFT_META_SKUID:
89 if (skb->sk == NULL || !sk_fullsock(skb->sk))90 sk = skb_to_full_sk(skb);
91 if (!sk || !sk_fullsock(sk))
90 goto err;92 goto err;
91 93
92 read_lock_bh(&skb->sk->sk_callback_lock);94 read_lock_bh(&sk->sk_callback_lock);
93 if (skb->sk->sk_socket == NULL ||95 if (sk->sk_socket == NULL ||
94 skb->sk->sk_socket->file == NULL) {96 sk->sk_socket->file == NULL) {
95 read_unlock_bh(&skb->sk->sk_callback_lock);97 read_unlock_bh(&sk->sk_callback_lock);
96 goto err;98 goto err;
97 }99 }
98 100
99 *dest = from_kuid_munged(&init_user_ns,101 *dest = from_kuid_munged(&init_user_ns,
100 skb->sk->sk_socket->file->f_cred->fsuid);102 sk->sk_socket->file->f_cred->fsuid);
101 read_unlock_bh(&skb->sk->sk_callback_lock);103 read_unlock_bh(&sk->sk_callback_lock);
102 break;104 break;
103 case NFT_META_SKGID:105 case NFT_META_SKGID:
104 if (skb->sk == NULL || !sk_fullsock(skb->sk))106 sk = skb_to_full_sk(skb);
107 if (!sk || !sk_fullsock(sk))
105 goto err;108 goto err;
106 109
107 read_lock_bh(&skb->sk->sk_callback_lock);110 read_lock_bh(&sk->sk_callback_lock);
108 if (skb->sk->sk_socket == NULL ||111 if (sk->sk_socket == NULL ||
109 skb->sk->sk_socket->file == NULL) {112 sk->sk_socket->file == NULL) {
110 read_unlock_bh(&skb->sk->sk_callback_lock);113 read_unlock_bh(&sk->sk_callback_lock);
111 goto err;114 goto err;
112 }115 }
113 *dest = from_kgid_munged(&init_user_ns,116 *dest = from_kgid_munged(&init_user_ns,
114 skb->sk->sk_socket->file->f_cred->fsgid);117 sk->sk_socket->file->f_cred->fsgid);
115 read_unlock_bh(&skb->sk->sk_callback_lock);118 read_unlock_bh(&sk->sk_callback_lock);
116 break;119 break;
117#ifdef CONFIG_IP_ROUTE_CLASSID120#ifdef CONFIG_IP_ROUTE_CLASSID
118 case NFT_META_RTCLASSID: {121 case NFT_META_RTCLASSID: {
@@ -168,9 +171,10 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 49 unmodified lines
168 break;171 break;
169#ifdef CONFIG_CGROUP_NET_CLASSID172#ifdef CONFIG_CGROUP_NET_CLASSID
170 case NFT_META_CGROUP:173 case NFT_META_CGROUP:
171 if (skb->sk == NULL || !sk_fullsock(skb->sk))174 sk = skb_to_full_sk(skb);
175 if (!sk || !sk_fullsock(sk))
172 goto err;176 goto err;
173 *dest = skb->sk->sk_classid;177 *dest = sk->sk_classid;
174 break;178 break;
175#endif179#endif
176 default:180 default:
net/netfilter/xt_TEE.c+4−2
@@ -31,8 +31,9 @@ static unsigned int · 30 unmodified lines
31tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)31tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)
32{32{
33 const struct xt_tee_tginfo *info = par->targinfo;33 const struct xt_tee_tginfo *info = par->targinfo;
34 int oif = info->priv ? info->priv->oif : 0;
34 35
35 nf_dup_ipv4(par->net, skb, par->hooknum, &info->gw.in, info->priv->oif);36 nf_dup_ipv4(par->net, skb, par->hooknum, &info->gw.in, oif);
36 37
37 return XT_CONTINUE;38 return XT_CONTINUE;
38}39}
@@ -42,8 +43,9 @@ static unsigned int · 3 unmodified lines
42tee_tg6(struct sk_buff *skb, const struct xt_action_param *par)43tee_tg6(struct sk_buff *skb, const struct xt_action_param *par)
43{44{
44 const struct xt_tee_tginfo *info = par->targinfo;45 const struct xt_tee_tginfo *info = par->targinfo;
46 int oif = info->priv ? info->priv->oif : 0;
45 47
46 nf_dup_ipv6(par->net, skb, par->hooknum, &info->gw.in6, info->priv->oif);48 nf_dup_ipv6(par->net, skb, par->hooknum, &info->gw.in6, oif);
47 49
48 return XT_CONTINUE;50 return XT_CONTINUE;
49}51}
net/netfilter/xt_owner.c+4−2
@@ -14,6 +14,7 @@ · 13 unmodified lines
14#include <linux/skbuff.h>14#include <linux/skbuff.h>
15#include <linux/file.h>15#include <linux/file.h>
16#include <net/sock.h>16#include <net/sock.h>
17#include <net/inet_sock.h>
17#include <linux/netfilter/x_tables.h>18#include <linux/netfilter/x_tables.h>
18#include <linux/netfilter/xt_owner.h>19#include <linux/netfilter/xt_owner.h>
19 20
@@ -33,8 +34,9 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) · 13 unmodified lines
33{34{
34 const struct xt_owner_match_info *info = par->matchinfo;35 const struct xt_owner_match_info *info = par->matchinfo;
35 const struct file *filp;36 const struct file *filp;
37 struct sock *sk = skb_to_full_sk(skb);
36 38
37 if (skb->sk == NULL || skb->sk->sk_socket == NULL)39 if (sk == NULL || sk->sk_socket == NULL)
38 return (info->match ^ info->invert) == 0;40 return (info->match ^ info->invert) == 0;
39 else if (info->match & info->invert & XT_OWNER_SOCKET)41 else if (info->match & info->invert & XT_OWNER_SOCKET)
40 /*42 /*
@@ -43,7 +45,7 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) · 2 unmodified lines
43 */45 */
44 return false;46 return false;
45 47
46 filp = skb->sk->sk_socket->file;48 filp = sk->sk_socket->file;
47 if (filp == NULL)49 if (filp == NULL)
48 return ((info->match ^ info->invert) &50 return ((info->match ^ info->invert) &
49 (XT_OWNER_UID | XT_OWNER_GID)) == 0;51 (XT_OWNER_UID | XT_OWNER_GID)) == 0;
net/packet/af_packet.c+49−31
@@ -2911,22 +2911,40 @@ static int packet_release(struct socket *sock) · 2910 unmodified lines
2911 * Attach a packet hook.2911 * Attach a packet hook.
2912 */2912 */
2913 2913
2914static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)2914static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
2915 __be16 proto)
2915{2916{
2916 struct packet_sock *po = pkt_sk(sk);2917 struct packet_sock *po = pkt_sk(sk);
2917 struct net_device *dev_curr;2918 struct net_device *dev_curr;
2918 __be16 proto_curr;2919 __be16 proto_curr;
2919 bool need_rehook;2920 bool need_rehook;
2921 struct net_device *dev = NULL;
2922 int ret = 0;
2923 bool unlisted = false;
2920 2924
2921 if (po->fanout) {2925 if (po->fanout)
2922 if (dev)
2923 dev_put(dev);
2924
2925 return -EINVAL;2926 return -EINVAL;
2926 }
2927 2927
2928 lock_sock(sk);2928 lock_sock(sk);
2929 spin_lock(&po->bind_lock);2929 spin_lock(&po->bind_lock);
2930 rcu_read_lock();
2931
2932 if (name) {
2933 dev = dev_get_by_name_rcu(sock_net(sk), name);
2934 if (!dev) {
2935 ret = -ENODEV;
2936 goto out_unlock;
2937 }
2938 } else if (ifindex) {
2939 dev = dev_get_by_index_rcu(sock_net(sk), ifindex);
2940 if (!dev) {
2941 ret = -ENODEV;
2942 goto out_unlock;
2943 }
2944 }
2945
2946 if (dev)
2947 dev_hold(dev);
2930 2948
2931 proto_curr = po->prot_hook.type;2949 proto_curr = po->prot_hook.type;
2932 dev_curr = po->prot_hook.dev;2950 dev_curr = po->prot_hook.dev;
@@ -2934,14 +2952,29 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) · 1 unmodified line
2934 need_rehook = proto_curr != proto || dev_curr != dev;2952 need_rehook = proto_curr != proto || dev_curr != dev;
2935 2953
2936 if (need_rehook) {2954 if (need_rehook) {
2937 unregister_prot_hook(sk, true);2955 if (po->running) {
2956 rcu_read_unlock();
2957 __unregister_prot_hook(sk, true);
2958 rcu_read_lock();
2959 dev_curr = po->prot_hook.dev;
2960 if (dev)
2961 unlisted = !dev_get_by_index_rcu(sock_net(sk),
2962 dev->ifindex);
2963 }
2938 2964
2939 po->num = proto;2965 po->num = proto;
2940 po->prot_hook.type = proto;2966 po->prot_hook.type = proto;
2941 po->prot_hook.dev = dev;
2942 2967
2943 po->ifindex = dev ? dev->ifindex : 0;2968 if (unlikely(unlisted)) {
2944 packet_cached_dev_assign(po, dev);2969 dev_put(dev);
2970 po->prot_hook.dev = NULL;
2971 po->ifindex = -1;
2972 packet_cached_dev_reset(po);
2973 } else {
2974 po->prot_hook.dev = dev;
2975 po->ifindex = dev ? dev->ifindex : 0;
2976 packet_cached_dev_assign(po, dev);
2977 }
2945 }2978 }
2946 if (dev_curr)2979 if (dev_curr)
2947 dev_put(dev_curr);2980 dev_put(dev_curr);
@@ -2949,7 +2982,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) · 1 unmodified line
2949 if (proto == 0 || !need_rehook)2982 if (proto == 0 || !need_rehook)
2950 goto out_unlock;2983 goto out_unlock;
2951 2984
2952 if (!dev || (dev->flags & IFF_UP)) {2985 if (!unlisted && (!dev || (dev->flags & IFF_UP))) {
2953 register_prot_hook(sk);2986 register_prot_hook(sk);
2954 } else {2987 } else {
2955 sk->sk_err = ENETDOWN;2988 sk->sk_err = ENETDOWN;
@@ -2958,9 +2991,10 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto) · 2 unmodified lines
2958 }2991 }
2959 2992
2960out_unlock:2993out_unlock:
2994 rcu_read_unlock();
2961 spin_unlock(&po->bind_lock);2995 spin_unlock(&po->bind_lock);
2962 release_sock(sk);2996 release_sock(sk);
2963 return 0;2997 return ret;
2964}2998}
2965 2999
2966/*3000/*
@@ -2972,8 +3006,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, · 5 unmodified lines
2972{3006{
2973 struct sock *sk = sock->sk;3007 struct sock *sk = sock->sk;
2974 char name[15];3008 char name[15];
2975 struct net_device *dev;
2976 int err = -ENODEV;
2977 3009
2978 /*3010 /*
2979 * Check legality3011 * Check legality
@@ -2983,19 +3015,13 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, · 3 unmodified lines
2983 return -EINVAL;3015 return -EINVAL;
2984 strlcpy(name, uaddr->sa_data, sizeof(name));3016 strlcpy(name, uaddr->sa_data, sizeof(name));
2985 3017
2986 dev = dev_get_by_name(sock_net(sk), name);3018 return packet_do_bind(sk, name, 0, pkt_sk(sk)->num);
2987 if (dev)
2988 err = packet_do_bind(sk, dev, pkt_sk(sk)->num);
2989 return err;
2990}3019}
2991 3020
2992static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)3021static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
2993{3022{
2994 struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr;3023 struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr;
2995 struct sock *sk = sock->sk;3024 struct sock *sk = sock->sk;
2996 struct net_device *dev = NULL;
2997 int err;
2998
2999 3025
3000 /*3026 /*
3001 * Check legality3027 * Check legality
@@ -3006,16 +3032,8 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len · 4 unmodified lines
3006 if (sll->sll_family != AF_PACKET)3032 if (sll->sll_family != AF_PACKET)
3007 return -EINVAL;3033 return -EINVAL;
3008 3034
3009 if (sll->sll_ifindex) {3035 return packet_do_bind(sk, NULL, sll->sll_ifindex,
3010 err = -ENODEV;3036 sll->sll_protocol ? : pkt_sk(sk)->num);
3011 dev = dev_get_by_index(sock_net(sk), sll->sll_ifindex);
3012 if (dev == NULL)
3013 goto out;
3014 }
3015 err = packet_do_bind(sk, dev, sll->sll_protocol ? : pkt_sk(sk)->num);
3016
3017out:
3018 return err;
3019}3037}
3020 3038
3021static struct proto packet_proto = {3039static struct proto packet_proto = {
net/sched/cls_flow.c+11−4
@@ -22,6 +22,7 @@ · 21 unmodified lines
22#include <linux/if_vlan.h>22#include <linux/if_vlan.h>
23#include <linux/slab.h>23#include <linux/slab.h>
24#include <linux/module.h>24#include <linux/module.h>
25#include <net/inet_sock.h>
25 26
26#include <net/pkt_cls.h>27#include <net/pkt_cls.h>
27#include <net/ip.h>28#include <net/ip.h>
@@ -197,8 +198,11 @@ static u32 flow_get_rtclassid(const struct sk_buff *skb) · 169 unmodified lines
197 198
198static u32 flow_get_skuid(const struct sk_buff *skb)199static u32 flow_get_skuid(const struct sk_buff *skb)
199{200{
200 if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) {201 struct sock *sk = skb_to_full_sk(skb);
201 kuid_t skuid = skb->sk->sk_socket->file->f_cred->fsuid;202
203 if (sk && sk->sk_socket && sk->sk_socket->file) {
204 kuid_t skuid = sk->sk_socket->file->f_cred->fsuid;
205
202 return from_kuid(&init_user_ns, skuid);206 return from_kuid(&init_user_ns, skuid);
203 }207 }
204 return 0;208 return 0;
@@ -206,8 +210,11 @@ static u32 flow_get_skuid(const struct sk_buff *skb) · 1 unmodified line
206 210
207static u32 flow_get_skgid(const struct sk_buff *skb)211static u32 flow_get_skgid(const struct sk_buff *skb)
208{212{
209 if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) {213 struct sock *sk = skb_to_full_sk(skb);
210 kgid_t skgid = skb->sk->sk_socket->file->f_cred->fsgid;214
215 if (sk && sk->sk_socket && sk->sk_socket->file) {
216 kgid_t skgid = sk->sk_socket->file->f_cred->fsgid;
217
211 return from_kgid(&init_user_ns, skgid);218 return from_kgid(&init_user_ns, skgid);
212 }219 }
213 return 0;220 return 0;
net/sched/em_meta.c+92−46
@@ -343,119 +343,145 @@ META_COLLECTOR(int_sk_refcnt) · 342 unmodified lines
343 343
344META_COLLECTOR(int_sk_rcvbuf)344META_COLLECTOR(int_sk_rcvbuf)
345{345{
346 if (skip_nonlocal(skb)) {346 const struct sock *sk = skb_to_full_sk(skb);
347
348 if (!sk) {
347 *err = -1;349 *err = -1;
348 return;350 return;
349 }351 }
350 dst->value = skb->sk->sk_rcvbuf;352 dst->value = sk->sk_rcvbuf;
351}353}
352 354
353META_COLLECTOR(int_sk_shutdown)355META_COLLECTOR(int_sk_shutdown)
354{356{
355 if (skip_nonlocal(skb)) {357 const struct sock *sk = skb_to_full_sk(skb);
358
359 if (!sk) {
356 *err = -1;360 *err = -1;
357 return;361 return;
358 }362 }
359 dst->value = skb->sk->sk_shutdown;363 dst->value = sk->sk_shutdown;
360}364}
361 365
362META_COLLECTOR(int_sk_proto)366META_COLLECTOR(int_sk_proto)
363{367{
364 if (skip_nonlocal(skb)) {368 const struct sock *sk = skb_to_full_sk(skb);
369
370 if (!sk) {
365 *err = -1;371 *err = -1;
366 return;372 return;
367 }373 }
368 dst->value = skb->sk->sk_protocol;374 dst->value = sk->sk_protocol;
369}375}
370 376
371META_COLLECTOR(int_sk_type)377META_COLLECTOR(int_sk_type)
372{378{
373 if (skip_nonlocal(skb)) {379 const struct sock *sk = skb_to_full_sk(skb);
380
381 if (!sk) {
374 *err = -1;382 *err = -1;
375 return;383 return;
376 }384 }
377 dst->value = skb->sk->sk_type;385 dst->value = sk->sk_type;
378}386}
379 387
380META_COLLECTOR(int_sk_rmem_alloc)388META_COLLECTOR(int_sk_rmem_alloc)
381{389{
382 if (skip_nonlocal(skb)) {390 const struct sock *sk = skb_to_full_sk(skb);
391
392 if (!sk) {
383 *err = -1;393 *err = -1;
384 return;394 return;
385 }395 }
386 dst->value = sk_rmem_alloc_get(skb->sk);396 dst->value = sk_rmem_alloc_get(sk);
387}397}
388 398
389META_COLLECTOR(int_sk_wmem_alloc)399META_COLLECTOR(int_sk_wmem_alloc)
390{400{
391 if (skip_nonlocal(skb)) {401 const struct sock *sk = skb_to_full_sk(skb);
402
403 if (!sk) {
392 *err = -1;404 *err = -1;
393 return;405 return;
394 }406 }
395 dst->value = sk_wmem_alloc_get(skb->sk);407 dst->value = sk_wmem_alloc_get(sk);
396}408}
397 409
398META_COLLECTOR(int_sk_omem_alloc)410META_COLLECTOR(int_sk_omem_alloc)
399{411{
400 if (skip_nonlocal(skb)) {412 const struct sock *sk = skb_to_full_sk(skb);
413
414 if (!sk) {
401 *err = -1;415 *err = -1;
402 return;416 return;
403 }417 }
404 dst->value = atomic_read(&skb->sk->sk_omem_alloc);418 dst->value = atomic_read(&sk->sk_omem_alloc);
405}419}
406 420
407META_COLLECTOR(int_sk_rcv_qlen)421META_COLLECTOR(int_sk_rcv_qlen)
408{422{
409 if (skip_nonlocal(skb)) {423 const struct sock *sk = skb_to_full_sk(skb);
424
425 if (!sk) {
410 *err = -1;426 *err = -1;
411 return;427 return;
412 }428 }
413 dst->value = skb->sk->sk_receive_queue.qlen;429 dst->value = sk->sk_receive_queue.qlen;
414}430}
415 431
416META_COLLECTOR(int_sk_snd_qlen)432META_COLLECTOR(int_sk_snd_qlen)
417{433{
418 if (skip_nonlocal(skb)) {434 const struct sock *sk = skb_to_full_sk(skb);
435
436 if (!sk) {
419 *err = -1;437 *err = -1;
420 return;438 return;
421 }439 }
422 dst->value = skb->sk->sk_write_queue.qlen;440 dst->value = sk->sk_write_queue.qlen;
423}441}
424 442
425META_COLLECTOR(int_sk_wmem_queued)443META_COLLECTOR(int_sk_wmem_queued)
426{444{
427 if (skip_nonlocal(skb)) {445 const struct sock *sk = skb_to_full_sk(skb);
446
447 if (!sk) {
428 *err = -1;448 *err = -1;
429 return;449 return;
430 }450 }
431 dst->value = skb->sk->sk_wmem_queued;451 dst->value = sk->sk_wmem_queued;
432}452}
433 453
434META_COLLECTOR(int_sk_fwd_alloc)454META_COLLECTOR(int_sk_fwd_alloc)
435{455{
436 if (skip_nonlocal(skb)) {456 const struct sock *sk = skb_to_full_sk(skb);
457
458 if (!sk) {
437 *err = -1;459 *err = -1;
438 return;460 return;
439 }461 }
440 dst->value = skb->sk->sk_forward_alloc;462 dst->value = sk->sk_forward_alloc;
441}463}
442 464
443META_COLLECTOR(int_sk_sndbuf)465META_COLLECTOR(int_sk_sndbuf)
444{466{
445 if (skip_nonlocal(skb)) {467 const struct sock *sk = skb_to_full_sk(skb);
468
469 if (!sk) {
446 *err = -1;470 *err = -1;
447 return;471 return;
448 }472 }
449 dst->value = skb->sk->sk_sndbuf;473 dst->value = sk->sk_sndbuf;
450}474}
451 475
452META_COLLECTOR(int_sk_alloc)476META_COLLECTOR(int_sk_alloc)
453{477{
454 if (skip_nonlocal(skb)) {478 const struct sock *sk = skb_to_full_sk(skb);
479
480 if (!sk) {
455 *err = -1;481 *err = -1;
456 return;482 return;
457 }483 }
458 dst->value = (__force int) skb->sk->sk_allocation;484 dst->value = (__force int) sk->sk_allocation;
459}485}
460 486
461META_COLLECTOR(int_sk_hash)487META_COLLECTOR(int_sk_hash)
@@ -469,92 +495,112 @@ META_COLLECTOR(int_sk_hash) · 7 unmodified lines
469 495
470META_COLLECTOR(int_sk_lingertime)496META_COLLECTOR(int_sk_lingertime)
471{497{
472 if (skip_nonlocal(skb)) {498 const struct sock *sk = skb_to_full_sk(skb);
499
500 if (!sk) {
473 *err = -1;501 *err = -1;
474 return;502 return;
475 }503 }
476 dst->value = skb->sk->sk_lingertime / HZ;504 dst->value = sk->sk_lingertime / HZ;
477}505}
478 506
479META_COLLECTOR(int_sk_err_qlen)507META_COLLECTOR(int_sk_err_qlen)
480{508{
481 if (skip_nonlocal(skb)) {509 const struct sock *sk = skb_to_full_sk(skb);
510
511 if (!sk) {
482 *err = -1;512 *err = -1;
483 return;513 return;
484 }514 }
485 dst->value = skb->sk->sk_error_queue.qlen;515 dst->value = sk->sk_error_queue.qlen;
486}516}
487 517
488META_COLLECTOR(int_sk_ack_bl)518META_COLLECTOR(int_sk_ack_bl)
489{519{
490 if (skip_nonlocal(skb)) {520 const struct sock *sk = skb_to_full_sk(skb);
521
522 if (!sk) {
491 *err = -1;523 *err = -1;
492 return;524 return;
493 }525 }
494 dst->value = skb->sk->sk_ack_backlog;526 dst->value = sk->sk_ack_backlog;
495}527}
496 528
497META_COLLECTOR(int_sk_max_ack_bl)529META_COLLECTOR(int_sk_max_ack_bl)
498{530{
499 if (skip_nonlocal(skb)) {531 const struct sock *sk = skb_to_full_sk(skb);
532
533 if (!sk) {
500 *err = -1;534 *err = -1;
501 return;535 return;
502 }536 }
503 dst->value = skb->sk->sk_max_ack_backlog;537 dst->value = sk->sk_max_ack_backlog;
504}538}
505 539
506META_COLLECTOR(int_sk_prio)540META_COLLECTOR(int_sk_prio)
507{541{
508 if (skip_nonlocal(skb)) {542 const struct sock *sk = skb_to_full_sk(skb);
543
544 if (!sk) {
509 *err = -1;545 *err = -1;
510 return;546 return;
511 }547 }
512 dst->value = skb->sk->sk_priority;548 dst->value = sk->sk_priority;
513}549}
514 550
515META_COLLECTOR(int_sk_rcvlowat)551META_COLLECTOR(int_sk_rcvlowat)
516{552{
517 if (skip_nonlocal(skb)) {553 const struct sock *sk = skb_to_full_sk(skb);
554
555 if (!sk) {
518 *err = -1;556 *err = -1;
519 return;557 return;
520 }558 }
521 dst->value = skb->sk->sk_rcvlowat;559 dst->value = sk->sk_rcvlowat;
522}560}
523 561
524META_COLLECTOR(int_sk_rcvtimeo)562META_COLLECTOR(int_sk_rcvtimeo)
525{563{
526 if (skip_nonlocal(skb)) {564 const struct sock *sk = skb_to_full_sk(skb);
565
566 if (!sk) {
527 *err = -1;567 *err = -1;
528 return;568 return;
529 }569 }
530 dst->value = skb->sk->sk_rcvtimeo / HZ;570 dst->value = sk->sk_rcvtimeo / HZ;
531}571}
532 572
533META_COLLECTOR(int_sk_sndtimeo)573META_COLLECTOR(int_sk_sndtimeo)
534{574{
535 if (skip_nonlocal(skb)) {575 const struct sock *sk = skb_to_full_sk(skb);
576
577 if (!sk) {
536 *err = -1;578 *err = -1;
537 return;579 return;
538 }580 }
539 dst->value = skb->sk->sk_sndtimeo / HZ;581 dst->value = sk->sk_sndtimeo / HZ;
540}582}
541 583
542META_COLLECTOR(int_sk_sendmsg_off)584META_COLLECTOR(int_sk_sendmsg_off)
543{585{
544 if (skip_nonlocal(skb)) {586 const struct sock *sk = skb_to_full_sk(skb);
587
588 if (!sk) {
545 *err = -1;589 *err = -1;
546 return;590 return;
547 }591 }
548 dst->value = skb->sk->sk_frag.offset;592 dst->value = sk->sk_frag.offset;
549}593}
550 594
551META_COLLECTOR(int_sk_write_pend)595META_COLLECTOR(int_sk_write_pend)
552{596{
553 if (skip_nonlocal(skb)) {597 const struct sock *sk = skb_to_full_sk(skb);
598
599 if (!sk) {
554 *err = -1;600 *err = -1;
555 return;601 return;
556 }602 }
557 dst->value = skb->sk->sk_write_pending;603 dst->value = sk->sk_write_pending;
558}604}
559 605
560/**************************************************************************606/**************************************************************************
net/vmw_vsock/vmci_transport.c+1−1
@@ -1234,7 +1234,7 @@ vmci_transport_recv_connecting_server(struct sock *listener, · 1233 unmodified lines
1234 /* Callers of accept() will be be waiting on the listening socket, not1234 /* Callers of accept() will be be waiting on the listening socket, not
1235 * the pending socket.1235 * the pending socket.
1236 */1236 */
1237 listener->sk_state_change(listener);1237 listener->sk_data_ready(listener);
1238 1238
1239 return 0;1239 return 0;
1240 1240
security/selinux/hooks.c+2−4
@@ -4933,7 +4933,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, · 4932 unmodified lines
4933 int ifindex,4933 int ifindex,
4934 u16 family)4934 u16 family)
4935{4935{
4936 struct sock *sk = skb->sk;4936 struct sock *sk = skb_to_full_sk(skb);
4937 struct sk_security_struct *sksec;4937 struct sk_security_struct *sksec;
4938 struct common_audit_data ad;4938 struct common_audit_data ad;
4939 struct lsm_network_audit net = {0,};4939 struct lsm_network_audit net = {0,};
@@ -4988,7 +4988,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, · 48 unmodified lines
4988 if (!secmark_active && !peerlbl_active)4988 if (!secmark_active && !peerlbl_active)
4989 return NF_ACCEPT;4989 return NF_ACCEPT;
4990 4990
4991 sk = skb->sk;4991 sk = skb_to_full_sk(skb);
4992 4992
4993#ifdef CONFIG_XFRM4993#ifdef CONFIG_XFRM
4994 /* If skb->dst->xfrm is non-NULL then the packet is undergoing an IPsec4994 /* If skb->dst->xfrm is non-NULL then the packet is undergoing an IPsec
@@ -5033,8 +5033,6 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, · 38 unmodified lines
5033 u32 skb_sid;5033 u32 skb_sid;
5034 struct sk_security_struct *sksec;5034 struct sk_security_struct *sksec;
5035 5035
5036 if (sk->sk_state == TCP_NEW_SYN_RECV)
5037 sk = inet_reqsk(sk)->rsk_listener;
5038 sksec = sk->sk_security;5036 sksec = sk->sk_security;
5039 if (selinux_skb_peerlbl_sid(skb, family, &skb_sid))5037 if (selinux_skb_peerlbl_sid(skb, family, &skb_sid))
5040 return NF_DROP;5038 return NF_DROP;
security/selinux/netlabel.c+1−1
@@ -245,7 +245,7 @@ int selinux_netlbl_skbuff_setsid(struct sk_buff *skb, · 244 unmodified lines
245 245
246 /* if this is a locally generated packet check to see if it is already246 /* if this is a locally generated packet check to see if it is already
247 * being labeled by it's parent socket, if it is just exit */247 * being labeled by it's parent socket, if it is just exit */
248 sk = skb->sk;248 sk = skb_to_full_sk(skb);
249 if (sk != NULL) {249 if (sk != NULL) {
250 struct sk_security_struct *sksec = sk->sk_security;250 struct sk_security_struct *sksec = sk->sk_security;
251 if (sksec->nlbl_state != NLBL_REQSKB)251 if (sksec->nlbl_state != NLBL_REQSKB)
security/smack/smack_netfilter.c+7−4
@@ -17,6 +17,7 @@ · 16 unmodified lines
17#include <linux/netfilter_ipv4.h>17#include <linux/netfilter_ipv4.h>
18#include <linux/netfilter_ipv6.h>18#include <linux/netfilter_ipv6.h>
19#include <linux/netdevice.h>19#include <linux/netdevice.h>
20#include <net/inet_sock.h>
20#include "smack.h"21#include "smack.h"
21 22
22#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)23#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -25,11 +26,12 @@ static unsigned int smack_ipv6_output(void *priv, · 2 unmodified lines
25 struct sk_buff *skb,26 struct sk_buff *skb,
26 const struct nf_hook_state *state)27 const struct nf_hook_state *state)
27{28{
29 struct sock *sk = skb_to_full_sk(skb);
28 struct socket_smack *ssp;30 struct socket_smack *ssp;
29 struct smack_known *skp;31 struct smack_known *skp;
30 32
31 if (skb && skb->sk && skb->sk->sk_security) {33 if (sk && sk->sk_security) {
32 ssp = skb->sk->sk_security;34 ssp = sk->sk_security;
33 skp = ssp->smk_out;35 skp = ssp->smk_out;
34 skb->secmark = skp->smk_secid;36 skb->secmark = skp->smk_secid;
35 }37 }
@@ -42,11 +44,12 @@ static unsigned int smack_ipv4_output(void *priv, · 6 unmodified lines
42 struct sk_buff *skb,44 struct sk_buff *skb,
43 const struct nf_hook_state *state)45 const struct nf_hook_state *state)
44{46{
47 struct sock *sk = skb_to_full_sk(skb);
45 struct socket_smack *ssp;48 struct socket_smack *ssp;
46 struct smack_known *skp;49 struct smack_known *skp;
47 50
48 if (skb && skb->sk && skb->sk->sk_security) {51 if (sk && sk->sk_security) {
49 ssp = skb->sk->sk_security;52 ssp = sk->sk_security;
50 skp = ssp->smk_out;53 skp = ssp->smk_out;
51 skb->secmark = skp->smk_secid;54 skb->secmark = skp->smk_secid;
52 }55 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t