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
4848 - mac-address : See ethernet.txt file in the same directory
4949 - phy-handle : See ethernet.txt file in the same directory
5050
51+Slave 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+
5156 Note: "ti,hwmods" field is used to fetch the base address and irq
5257 resources from TI, omap hwmod data base during device registration.
5358 Future 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
596596 before a conversion to the new layout is being done behind the scenes!
597597
598598 Currently, the classic BPF format is being used for JITing on most of the
599−architectures. Only x86-64 performs JIT compilation from eBPF instruction set,
600−however, future work will migrate other JIT compilers as well, so that they
601−will profit from the very same benefits.
599+architectures. x86-64, aarch64 and s390x perform JIT compilation from eBPF
600+instruction set, however, future work will migrate other JIT compilers as well,
601+so that they will profit from the very same benefits.
602602
603603 Some core changes of the new internal format:
604604
Documentation/networking/ip-sysctl.txt+1−1
@@ -709,7 +709,7 @@ tcp_limit_output_bytes - INTEGER · 708 unmodified lines
709709 typical pfifo_fast qdiscs.
710710 tcp_limit_output_bytes limits the number of bytes on qdisc
711711 or device to reduce artificial RTT/cwnd and reduce bufferbloat.
712− Default: 131072
712+ Default: 262144
713713
714714 tcp_challenge_ack_limit - INTEGER
715715 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
13721372 }
13731373
13741374 if (data->isoc_altsetting != new_alts) {
1375+ unsigned long flags;
1376+
13751377 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
13761378 usb_kill_anchored_urbs(&data->isoc_anchor);
13771379
@@ -1384,10 +1386,10 @@ static void btusb_work(struct work_struct *work) · 6 unmodified lines
13841386 * Clear outstanding fragment when selecting a new
13851387 * alternate setting.
13861388 */
1387− spin_lock(&data->rxlock);
1389+ spin_lock_irqsave(&data->rxlock, flags);
13881390 kfree_skb(data->sco_skb);
13891391 data->sco_skb = NULL;
1390− spin_unlock(&data->rxlock);
1392+ spin_unlock_irqrestore(&data->rxlock, flags);
13911393
13921394 if (__set_isoc_interface(hdev, new_alts) < 0)
13931395 return;
drivers/net/bonding/bond_main.c+1−0
@@ -1749,6 +1749,7 @@ err_undo_flags: · 1748 unmodified lines
17491749 slave_dev->dev_addr))
17501750 eth_hw_addr_random(bond_dev);
17511751 if (bond_dev->type != ARPHRD_ETHER) {
1752+ dev_close(bond_dev);
17521753 ether_setup(bond_dev);
17531754 bond_dev->flags |= IFF_MASTER;
17541755 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
730730 int res;
731731 dev = (struct cfspi_dev *)pdev->dev.platform_data;
732732
733− ndev = alloc_netdev(sizeof(struct cfspi), "cfspi%d",
734− NET_NAME_UNKNOWN, cfspi_setup);
735733 if (!dev)
736734 return -ENODEV;
737735
736+ ndev = alloc_netdev(sizeof(struct cfspi), "cfspi%d",
737+ NET_NAME_UNKNOWN, cfspi_setup);
738+ if (!ndev)
739+ return -ENOMEM;
740+
738741 cfspi = netdev_priv(ndev);
739742 netif_stop_queue(ndev);
740743 cfspi->ndev = ndev;
drivers/net/dsa/mv88e6171.c+2−0
@@ -103,6 +103,8 @@ struct dsa_switch_driver mv88e6171_switch_driver = { · 102 unmodified lines
103103 #endif
104104 .get_regs_len = mv88e6xxx_get_regs_len,
105105 .get_regs = mv88e6xxx_get_regs,
106+ .port_join_bridge = mv88e6xxx_port_bridge_join,
107+ .port_leave_bridge = mv88e6xxx_port_bridge_leave,
106108 .port_stp_update = mv88e6xxx_port_stp_update,
107109 .port_pvid_get = mv88e6xxx_port_pvid_get,
108110 .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
323323 .set_eeprom = mv88e6352_set_eeprom,
324324 .get_regs_len = mv88e6xxx_get_regs_len,
325325 .get_regs = mv88e6xxx_get_regs,
326+ .port_join_bridge = mv88e6xxx_port_bridge_join,
327+ .port_leave_bridge = mv88e6xxx_port_bridge_leave,
326328 .port_stp_update = mv88e6xxx_port_stp_update,
327329 .port_pvid_get = mv88e6xxx_port_pvid_get,
328330 .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
14621462 const struct switchdev_obj_port_vlan *vlan,
14631463 struct switchdev_trans *trans)
14641464 {
1465+ /* We reserve a few VLANs to isolate unbridged ports */
1466+ if (vlan->vid_end >= 4000)
1467+ return -EOPNOTSUPP;
1468+
14651469 /* We don't need any dynamic resource from the kernel (yet),
14661470 * so skip the prepare phase.
14671471 */
@@ -1870,6 +1874,36 @@ unlock: · 402 unmodified lines
18701874 return err;
18711875 }
18721876
1877+int 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+
1892+int 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+
18731907 static void mv88e6xxx_bridge_work(struct work_struct *work)
18741908 {
18751909 struct mv88e6xxx_priv_state *ps;
@@ -2140,6 +2174,14 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds) · 264 unmodified lines
21402174 ret = mv88e6xxx_setup_port(ds, i);
21412175 if (ret < 0)
21422176 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;
21432185 }
21442186 return 0;
21452187 }
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
468468 int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
469469 int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
470470 struct phy_device *phydev, struct ethtool_eee *e);
471+int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, u32 members);
472+int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, u32 members);
471473 int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state);
472474 int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
473475 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
459459 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, 0);
460460 }
461461
462+static 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+
462501 static void xgene_gmac_init(struct xgene_enet_pdata *pdata)
463502 {
464503 struct device *dev = &pdata->pdev->dev;
@@ -477,12 +516,14 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 12 unmodified lines
477516 switch (pdata->phy_speed) {
478517 case SPEED_10:
479518 ENET_INTERFACE_MODE2_SET(&mc2, 1);
519+ intf_ctl &= ~(ENET_LHD_MODE | ENET_GHD_MODE);
480520 CFG_MACMODE_SET(&icm0, 0);
481521 CFG_WAITASYNCRD_SET(&icm2, 500);
482522 rgmii &= ~CFG_SPEED_1250;
483523 break;
484524 case SPEED_100:
485525 ENET_INTERFACE_MODE2_SET(&mc2, 1);
526+ intf_ctl &= ~ENET_GHD_MODE;
486527 intf_ctl |= ENET_LHD_MODE;
487528 CFG_MACMODE_SET(&icm0, 1);
488529 CFG_WAITASYNCRD_SET(&icm2, 80);
@@ -490,12 +531,15 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 1 unmodified line
490531 break;
491532 default:
492533 ENET_INTERFACE_MODE2_SET(&mc2, 2);
534+ intf_ctl &= ~ENET_LHD_MODE;
493535 intf_ctl |= ENET_GHD_MODE;
494−
536+ CFG_MACMODE_SET(&icm0, 2);
537+ CFG_WAITASYNCRD_SET(&icm2, 0);
495538 if (dev->of_node) {
496539 CFG_TXCLK_MUXSEL0_SET(&rgmii, pdata->tx_delay);
497540 CFG_RXCLK_MUXSEL0_SET(&rgmii, pdata->rx_delay);
498541 }
542+ rgmii |= CFG_SPEED_1250;
499543
500544 xgene_enet_rd_csr(pdata, DEBUG_REG_ADDR, &value);
501545 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
503547 break;
504548 }
505549
506− mc2 |= FULL_DUPLEX2;
550+ mc2 |= FULL_DUPLEX2 | PAD_CRC;
507551 xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_2_ADDR, mc2);
508552 xgene_enet_wr_mcx_mac(pdata, INTERFACE_CONTROL_ADDR, intf_ctl);
509553
@@ -522,6 +566,7 @@ static void xgene_gmac_init(struct xgene_enet_pdata *pdata) · 12 unmodified lines
522566 /* Rtype should be copied from FP */
523567 xgene_enet_wr_csr(pdata, RSIF_RAM_DBG_REG0_ADDR, 0);
524568 xgene_enet_wr_csr(pdata, RGMII_REG_0_ADDR, rgmii);
569+ xgene_enet_configure_clock(pdata);
525570
526571 /* Rx-Tx traffic resume */
527572 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
181181 #define ENET_LHD_MODE BIT(25)
182182 #define ENET_GHD_MODE BIT(26)
183183 #define FULL_DUPLEX2 BIT(0)
184+#define PAD_CRC BIT(2)
184185 #define SCAN_AUTO_INCR BIT(5)
185186 #define TBYT_ADDR 0x38
186187 #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
698698 else
699699 schedule_delayed_work(&pdata->link_work, PHY_POLL_LINK_OFF);
700700
701− netif_carrier_off(ndev);
702701 netif_start_queue(ndev);
703702
704703 return ret;
drivers/net/ethernet/broadcom/Kconfig+1−0
@@ -173,6 +173,7 @@ config SYSTEMPORT · 172 unmodified lines
173173 config BNXT
174174 tristate "Broadcom NetXtreme-C/E support"
175175 depends on PCI
176+ depends on VXLAN || VXLAN=n
176177 select FW_LOADER
177178 select LIBCRC32C
178179 ---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
12921292 return TX_CMP_VALID(txcmp, raw_cons);
12931293 }
12941294
1295−#define CAG_LEGACY_INT_STATUS 0x2014
1296−
12971295 static irqreturn_t bnxt_inta(int irq, void *dev_instance)
12981296 {
12991297 struct bnxt_napi *bnapi = dev_instance;
@@ -1305,7 +1303,7 @@ static irqreturn_t bnxt_inta(int irq, void *dev_instance) · 5 unmodified lines
13051303 prefetch(&cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)]);
13061304
13071305 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);
13091307 /* return if erroneous interrupt */
13101308 if (!(int_status & (0x10000 << cpr->cp_ring_struct.fw_ring_id)))
13111309 return IRQ_NONE;
@@ -4527,10 +4525,25 @@ static int bnxt_update_phy_setting(struct bnxt *bp) · 3215 unmodified lines
45274525 return rc;
45284526 }
45294527
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+ */
4533+static 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+
45304542 static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
45314543 {
45324544 int rc = 0;
45334545
4546+ bnxt_preset_reg_win(bp);
45344547 netif_carrier_off(bp->dev);
45354548 if (irq_re_init) {
45364549 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
52945307 struct bnxt_ntuple_filter *fltr, *new_fltr;
52955308 struct flow_keys *fkeys;
52965309 struct ethhdr *eth = (struct ethhdr *)skb_mac_header(skb);
5297− int rc = 0, idx;
5310+ int rc = 0, idx, bit_id;
52985311 struct hlist_head *head;
52995312
53005313 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
53325345 rcu_read_unlock();
53335346
53345347 spin_lock_bh(&bp->ntp_fltr_lock);
5335− new_fltr->sw_id = bitmap_find_free_region(bp->ntp_fltr_bmap,
5336− BNXT_NTP_FLTR_MAX_FLTR, 0);
5337− if (new_fltr->sw_id < 0) {
5348+ bit_id = bitmap_find_free_region(bp->ntp_fltr_bmap,
5349+ BNXT_NTP_FLTR_MAX_FLTR, 0);
5350+ if (bit_id < 0) {
53385351 spin_unlock_bh(&bp->ntp_fltr_lock);
53395352 rc = -ENOMEM;
53405353 goto err_free;
53415354 }
53425355
5356+ new_fltr->sw_id = (u16)bit_id;
53435357 new_fltr->flow_id = flow_id;
53445358 new_fltr->rxq = rxq_index;
53455359 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
166166 #define RX_CMP_HASH_VALID(rxcmp) \
167167 ((rxcmp)->rx_cmp_len_flags_type & cpu_to_le32(RX_CMP_FLAGS_RSS_VALID))
168168
169+#define RSS_PROFILE_ID_MASK 0x1f
170+
169171 #define RX_CMP_HASH_TYPE(rxcmp) \
170− ((le32_to_cpu((rxcmp)->rx_cmp_misc_v1) & RX_CMP_RSS_HASH_TYPE) >>\
171− RX_CMP_RSS_HASH_TYPE_SHIFT)
172+ (((le32_to_cpu((rxcmp)->rx_cmp_misc_v1) & RX_CMP_RSS_HASH_TYPE) >>\
173+ RX_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK)
172174
173175 struct rx_cmp_ext {
174176 __le32 rx_cmp_flags2;
@@ -282,9 +284,9 @@ struct rx_tpa_start_cmp { · 107 unmodified lines
282284 cpu_to_le32(RX_TPA_START_CMP_FLAGS_RSS_VALID))
283285
284286 #define TPA_START_HASH_TYPE(rx_tpa_start) \
285− ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \
286− RX_TPA_START_CMP_RSS_HASH_TYPE) >> \
287− RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT)
287+ (((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \
288+ RX_TPA_START_CMP_RSS_HASH_TYPE) >> \
289+ RX_TPA_START_CMP_RSS_HASH_TYPE_SHIFT) & RSS_PROFILE_ID_MASK)
288290
289291 #define TPA_START_AGG_ID(rx_tpa_start) \
290292 ((le32_to_cpu((rx_tpa_start)->rx_tpa_start_cmp_misc_v1) & \
@@ -839,6 +841,10 @@ struct bnxt_queue_info { · 548 unmodified lines
839841 u8 queue_profile;
840842 };
841843
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+
842848 struct bnxt {
843849 void __iomem *bar0;
844850 void __iomem *bar1;
@@ -959,11 +965,11 @@ struct bnxt { · 114 unmodified lines
959965 #define BNXT_RX_MASK_SP_EVENT 0
960966 #define BNXT_RX_NTP_FLTR_SP_EVENT 1
961967 #define BNXT_LINK_CHNG_SP_EVENT 2
962−#define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT 4
963−#define BNXT_VXLAN_ADD_PORT_SP_EVENT 8
964−#define BNXT_VXLAN_DEL_PORT_SP_EVENT 16
965−#define BNXT_RESET_TASK_SP_EVENT 32
966−#define BNXT_RST_RING_SP_EVENT 64
968+#define BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT 3
969+#define BNXT_VXLAN_ADD_PORT_SP_EVENT 4
970+#define BNXT_VXLAN_DEL_PORT_SP_EVENT 5
971+#define BNXT_RESET_TASK_SP_EVENT 6
972+#define BNXT_RST_RING_SP_EVENT 7
967973
968974 struct bnxt_pf_info pf;
969975 #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
258258 return 0;
259259 }
260260
261−static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp)
261+static int bnxt_hwrm_func_vf_resource_free(struct bnxt *bp, int num_vfs)
262262 {
263263 int i, rc = 0;
264264 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
267267 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_VF_RESC_FREE, -1, -1);
268268
269269 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++) {
271271 req.vf_id = cpu_to_le16(i);
272272 rc = _hwrm_send_message(bp, &req, sizeof(req),
273273 HWRM_CMD_TIMEOUT);
@@ -509,7 +509,7 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) · 235 unmodified lines
509509
510510 err_out2:
511511 /* 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);
513513
514514 err_out1:
515515 bnxt_free_vf_resources(bp);
@@ -519,13 +519,19 @@ err_out1: · 3 unmodified lines
519519
520520 void bnxt_sriov_disable(struct bnxt *bp)
521521 {
522− if (!bp->pf.active_vfs)
523− return;
522+ u16 num_vfs = pci_num_vf(bp->pdev);
524523
525− pci_disable_sriov(bp->pdev);
524+ if (!num_vfs)
525+ return;
526526
527− /* Free the resources reserved for various VF's */
528− bnxt_hwrm_func_vf_resource_free(bp);
527+ if (pci_vfs_assigned(bp->pdev)) {
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+ }
529535
530536 bnxt_free_vf_resources(bp);
531537
@@ -552,17 +558,25 @@ int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) · 20 unmodified lines
552558 }
553559 bp->sriov_cfg = true;
554560 rtnl_unlock();
555− if (!num_vfs) {
556− bnxt_sriov_disable(bp);
557− return 0;
561+
562+ if (pci_vfs_assigned(bp->pdev)) {
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;
558566 }
559567
560568 /* Check if enabled VFs is same as requested */
561− if (num_vfs == bp->pf.active_vfs)
562− return 0;
569+ if (num_vfs && num_vfs == bp->pf.active_vfs)
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;
563576
564577 bnxt_sriov_enable(bp, &num_vfs);
565578
579+sriov_cfg_exit:
566580 bp->sriov_cfg = false;
567581 wake_up(&bp->sriov_cfg_wait);
568582
drivers/net/ethernet/hisilicon/Kconfig+2−1
@@ -5,7 +5,8 @@ · 4 unmodified lines
55 config NET_VENDOR_HISILICON
66 bool "Hisilicon devices"
77 default y
8− depends on OF && (ARM || ARM64 || COMPILE_TEST)
8+ depends on OF && HAS_DMA
9+ depends on ARM || ARM64 || COMPILE_TEST
910 ---help---
1011 If you have a network (Ethernet) card belonging to this class, say Y.
1112
drivers/net/ethernet/marvell/Kconfig+1−0
@@ -44,6 +44,7 @@ config MVNETA · 43 unmodified lines
4444 tristate "Marvell Armada 370/38x/XP network interface support"
4545 depends on PLAT_ORION
4646 select MVMDIO
47+ select FIXED_PHY
4748 ---help---
4849 This driver supports the network interface units in the
4950 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
14931493 struct mvneta_rx_desc *rx_desc = rxq->descs + i;
14941494 void *data = (void *)rx_desc->buf_cookie;
14951495
1496− mvneta_frag_free(pp, data);
14971496 dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr,
14981497 MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE);
1498+ mvneta_frag_free(pp, data);
14991499 }
15001500
15011501 if (rx_done)
drivers/net/ethernet/qlogic/Kconfig+1−0
@@ -94,6 +94,7 @@ config NETXEN_NIC · 93 unmodified lines
9494 config QED
9595 tristate "QLogic QED 25/40/100Gb core driver"
9696 depends on PCI
97+ select ZLIB_INFLATE
9798 ---help---
9899 This enables the support for ...
99100
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
223223 if (!p_hwfn->p_tx_cids) {
224224 DP_NOTICE(p_hwfn,
225225 "Failed to allocate memory for Tx Cids\n");
226+ rc = -ENOMEM;
226227 goto alloc_err;
227228 }
228229
@@ -230,6 +231,7 @@ int qed_resc_alloc(struct qed_dev *cdev) · 1 unmodified line
230231 if (!p_hwfn->p_rx_cids) {
231232 DP_NOTICE(p_hwfn,
232233 "Failed to allocate memory for Rx Cids\n");
234+ rc = -ENOMEM;
233235 goto alloc_err;
234236 }
235237 }
@@ -281,14 +283,17 @@ int qed_resc_alloc(struct qed_dev *cdev) · 45 unmodified lines
281283
282284 /* EQ */
283285 p_eq = qed_eq_alloc(p_hwfn, 256);
284−
285− if (!p_eq)
286+ if (!p_eq) {
287+ rc = -ENOMEM;
286288 goto alloc_err;
289+ }
287290 p_hwfn->p_eq = p_eq;
288291
289292 p_consq = qed_consq_alloc(p_hwfn);
290− if (!p_consq)
293+ if (!p_consq) {
294+ rc = -ENOMEM;
291295 goto alloc_err;
296+ }
292297 p_hwfn->p_consq = p_consq;
293298
294299 /* DMA info initialization */
@@ -303,6 +308,7 @@ int qed_resc_alloc(struct qed_dev *cdev) · 8 unmodified lines
303308 cdev->reset_stats = kzalloc(sizeof(*cdev->reset_stats), GFP_KERNEL);
304309 if (!cdev->reset_stats) {
305310 DP_NOTICE(cdev, "Failed to allocate reset statistics\n");
311+ rc = -ENOMEM;
306312 goto alloc_err;
307313 }
308314
@@ -562,7 +568,7 @@ static int qed_hw_init_pf(struct qed_hwfn *p_hwfn, · 253 unmodified lines
562568 }
563569
564570 /* Enable classification by MAC if needed */
565− if (hw_mode & MODE_MF_SI) {
571+ if (hw_mode & (1 << MODE_MF_SI)) {
566572 DP_VERBOSE(p_hwfn, NETIF_MSG_HW,
567573 "Configuring TAGMAC_CLS_TYPE\n");
568574 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
251251 int arr_size;
252252 u16 rc = 0;
253253
254− if (!p_hwfn) {
255− DP_ERR(p_hwfn->cdev, "DPC called - no hwfn!\n");
256− return;
257− }
258−
259254 if (!p_hwfn->p_sp_sb) {
260255 DP_ERR(p_hwfn->cdev, "DPC called - no p_sp_sb\n");
261256 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
353353 if (!is_valid_ether_addr(addr->sa_data))
354354 return -EINVAL;
355355
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))
357358 return 0;
358359
359360 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
10981098 static void sh_eth_ring_free(struct net_device *ndev)
10991099 {
11001100 struct sh_eth_private *mdp = netdev_priv(ndev);
1101− int i;
1101+ int ringsize, i;
11021102
11031103 /* Free Rx skb ringbuffer */
11041104 if (mdp->rx_skbuff) {
@@ -1115,6 +1115,20 @@ static void sh_eth_ring_free(struct net_device *ndev) · 10 unmodified lines
11151115 }
11161116 kfree(mdp->tx_skbuff);
11171117 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+ }
11181132 }
11191133
11201134 /* format skb and descriptor buffer */
@@ -1199,7 +1213,7 @@ static void sh_eth_ring_format(struct net_device *ndev) · 78 unmodified lines
11991213 static int sh_eth_ring_init(struct net_device *ndev)
12001214 {
12011215 struct sh_eth_private *mdp = netdev_priv(ndev);
1202− int rx_ringsize, tx_ringsize, ret = 0;
1216+ int rx_ringsize, tx_ringsize;
12031217
12041218 /* +26 gets the maximum ethernet encapsulation, +7 & ~7 because the
12051219 * 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
12141228 /* Allocate RX and TX skb rings */
12151229 mdp->rx_skbuff = kcalloc(mdp->num_rx_ring, sizeof(*mdp->rx_skbuff),
12161230 GFP_KERNEL);
1217− if (!mdp->rx_skbuff) {
1218− ret = -ENOMEM;
1219− return ret;
1220− }
1231+ if (!mdp->rx_skbuff)
1232+ return -ENOMEM;
12211233
12221234 mdp->tx_skbuff = kcalloc(mdp->num_tx_ring, sizeof(*mdp->tx_skbuff),
12231235 GFP_KERNEL);
1224− if (!mdp->tx_skbuff) {
1225− ret = -ENOMEM;
1226− goto skb_ring_free;
1227− }
1236+ if (!mdp->tx_skbuff)
1237+ goto ring_free;
12281238
12291239 /* Allocate all Rx descriptors. */
12301240 rx_ringsize = sizeof(struct sh_eth_rxdesc) * mdp->num_rx_ring;
12311241 mdp->rx_ring = dma_alloc_coherent(NULL, rx_ringsize, &mdp->rx_desc_dma,
12321242 GFP_KERNEL);
1233− if (!mdp->rx_ring) {
1234− ret = -ENOMEM;
1235− goto skb_ring_free;
1236− }
1243+ if (!mdp->rx_ring)
1244+ goto ring_free;
12371245
12381246 mdp->dirty_rx = 0;
12391247
@@ -1241,42 +1249,15 @@ static int sh_eth_ring_init(struct net_device *ndev) · 1 unmodified line
12411249 tx_ringsize = sizeof(struct sh_eth_txdesc) * mdp->num_tx_ring;
12421250 mdp->tx_ring = dma_alloc_coherent(NULL, tx_ringsize, &mdp->tx_desc_dma,
12431251 GFP_KERNEL);
1244− if (!mdp->tx_ring) {
1245− ret = -ENOMEM;
1246− goto desc_ring_free;
1247− }
1248− return ret;
1249−
1250−desc_ring_free:
1251− /* free DMA buffer */
1252− dma_free_coherent(NULL, rx_ringsize, mdp->rx_ring, mdp->rx_desc_dma);
1252+ if (!mdp->tx_ring)
1253+ goto ring_free;
1254+ return 0;
12531255
1254−skb_ring_free:
1255− /* Free Rx and Tx skb ring buffer */
1256+ring_free:
1257+ /* Free Rx and Tx skb ring buffer and DMA buffer */
12561258 sh_eth_ring_free(ndev);
1257− mdp->tx_ring = NULL;
1258− mdp->rx_ring = NULL;
1259−
1260− return ret;
1261−}
1262−
1263−static 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− }
12731259
1274− if (mdp->tx_ring) {
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− }
1260+ return -ENOMEM;
12801261 }
12811262
12821263 static 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
22392220
22402221 sh_eth_dev_exit(ndev);
22412222
2242− /* Free all the skbuffs in the Rx queue. */
2223+ /* Free all the skbuffs in the Rx queue and the DMA buffers. */
22432224 sh_eth_ring_free(ndev);
2244− /* Free DMA buffer */
2245− sh_eth_free_dma_buffer(mdp);
22462225 }
22472226
22482227 /* Set new parameters */
@@ -2487,12 +2466,9 @@ static int sh_eth_close(struct net_device *ndev) · 238 unmodified lines
24872466
24882467 free_irq(ndev->irq, ndev);
24892468
2490− /* Free all the skbuffs in the Rx queue. */
2469+ /* Free all the skbuffs in the Rx queue and the DMA buffer. */
24912470 sh_eth_ring_free(ndev);
24922471
2493− /* free DMA buffer */
2494− sh_eth_free_dma_buffer(mdp);
2495−
24962472 pm_runtime_put_sync(&mdp->pdev->dev);
24972473
24982474 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
354354
355355 static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
356356 {
357− int phy_iface = phy_iface = bsp_priv->phy_iface;
357+ int phy_iface = bsp_priv->phy_iface;
358358
359359 if (enable) {
360360 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
29702970 err_out_clk_dis_aper:
29712971 clk_disable_unprepare(lp->apb_pclk);
29722972 err_out_free_netdev:
2973− if (lp->phy_node)
2974− of_node_put(lp->phy_node);
2973+ of_node_put(lp->phy_node);
29752974 free_netdev(ndev);
29762975 platform_set_drvdata(pdev, NULL);
29772976 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
20372037 continue;
20382038
20392039 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+ }
20402053 parp = of_get_property(slave_node, "phy_id", &lenp);
20412054 if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) {
20422055 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
143143
144144 static void fjes_hw_free_epbuf(struct epbuf_handler *epbh)
145145 {
146− if (epbh->buffer)
147− vfree(epbh->buffer);
148−
146+ vfree(epbh->buffer);
149147 epbh->buffer = NULL;
150148 epbh->size = 0;
151149
drivers/net/macvtap.c+3−2
@@ -935,6 +935,9 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, · 934 unmodified lines
935935 /* Nothing to read, let's sleep */
936936 schedule();
937937 }
938+ if (!noblock)
939+ finish_wait(sk_sleep(&q->sk), &wait);
940+
938941 if (skb) {
939942 ret = macvtap_put_user(q, skb, to);
940943 if (unlikely(ret < 0))
@@ -942,8 +945,6 @@ static ssize_t macvtap_do_read(struct macvtap_queue *q, · 1 unmodified line
942945 else
943946 consume_skb(skb);
944947 }
945− if (!noblock)
946− finish_wait(sk_sleep(&q->sk), &wait);
947948 return ret;
948949 }
949950
drivers/net/usb/qmi_wwan.c+21−0
@@ -771,6 +771,7 @@ static const struct usb_device_id products[] = { · 770 unmodified lines
771771 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
772772 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
773773 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
774+ {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */
774775 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
775776 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
776777 {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
802803 };
803804 MODULE_DEVICE_TABLE(usb, products);
804805
806+static 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+
805819 static int qmi_wwan_probe(struct usb_interface *intf,
806820 const struct usb_device_id *prod)
807821 {
808822 struct usb_device_id *id = (struct usb_device_id *)prod;
823+ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
809824
810825 /* Workaround to enable dynamic IDs. This disables usbnet
811826 * blacklisting functionality. Which, if required, can be
@@ -817,6 +832,12 @@ static int qmi_wwan_probe(struct usb_interface *intf, · 5 unmodified lines
817832 id->driver_info = (unsigned long)&qmi_wwan_info;
818833 }
819834
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+
820841 return usbnet_probe(intf, id);
821842 }
822843
drivers/nfc/nfcmrvl/Kconfig+1−1
@@ -44,7 +44,7 @@ config NFC_MRVL_I2C · 43 unmodified lines
4444
4545 config NFC_MRVL_SPI
4646 tristate "Marvell NFC-over-SPI driver"
47− depends on NFC_MRVL && SPI
47+ depends on NFC_MRVL && NFC_NCI_SPI
4848 help
4949 Marvell NFC-over-SPI driver.
5050
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
113113 }
114114
115115 atomic_set(&priv->ndev->cmd_cnt, 0);
116− del_timer_sync(&priv->ndev->cmd_timer);
117116
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);
119122
120123 nfc_info(priv->dev, "FW loading over (%d)]\n", error);
121124
@@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv) · 350 unmodified lines
472475 void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
473476 struct sk_buff *skb)
474477 {
478+ /* Discard command timer */
479+ if (timer_pending(&priv->ndev->cmd_timer))
480+ del_timer_sync(&priv->ndev->cmd_timer);
481+
475482 /* Allow next command */
476483 atomic_set(&priv->ndev->cmd_cnt, 1);
477− del_timer_sync(&priv->ndev->cmd_timer);
478484
479485 /* Queue and trigger rx work */
480486 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
194194
195195 nfcmrvl_fw_dnld_deinit(priv);
196196
197+ if (priv->config.reset_n_io)
198+ devm_gpio_free(priv->dev, priv->config.reset_n_io);
199+
197200 nci_unregister_device(ndev);
198201 nci_free_device(ndev);
199202 kfree(priv);
@@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv) · 51 unmodified lines
251254 gpio_set_value(priv->config.reset_n_io, 0);
252255 }
253256
254−#ifdef CONFIG_OF
255−
256257 int nfcmrvl_parse_dt(struct device_node *node,
257258 struct nfcmrvl_platform_data *pdata)
258259 {
@@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node, · 16 unmodified lines
275276
276277 return 0;
277278 }
278−
279−#else
280−
281−int nfcmrvl_parse_dt(struct device_node *node,
282− struct nfcmrvl_platform_data *pdata)
283−{
284− return -ENODEV;
285−}
286−
287−#endif
288279 EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);
289280
290281 MODULE_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
6767 .nci_update_config = nfcmrvl_uart_nci_update_config
6868 };
6969
70−#ifdef CONFIG_OF
71−
7270 static int nfcmrvl_uart_parse_dt(struct device_node *node,
7371 struct nfcmrvl_platform_data *pdata)
7472 {
@@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node, · 27 unmodified lines
102100 return 0;
103101 }
104102
105−#else
106−
107−static int nfcmrvl_uart_parse_dt(struct device_node *node,
108− struct nfcmrvl_platform_data *pdata)
109−{
110− return -ENODEV;
111−}
112−
113−#endif
114−
115103 /*
116104 ** NCI UART OPS
117105 */
@@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu) · 34 unmodified lines
152140 nu->drv_data = priv;
153141 nu->ndev = priv->ndev;
154142
155− /* Set BREAK */
156− if (priv->config.break_control && nu->tty->ops->break_ctl)
157− nu->tty->ops->break_ctl(nu->tty, -1);
158−
159143 return 0;
160144 }
161145
@@ -174,6 +158,9 @@ static void nfcmrvl_nci_uart_tx_start(struct nci_uart *nu) · 12 unmodified lines
174158 {
175159 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
176160
161+ if (priv->ndev->nfc_dev->fw_download_in_progress)
162+ return;
163+
177164 /* Remove BREAK to wake up the NFCC */
178165 if (priv->config.break_control && nu->tty->ops->break_ctl) {
179166 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
185172 {
186173 struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
187174
175+ if (priv->ndev->nfc_dev->fw_download_in_progress)
176+ return;
177+
188178 /*
189179 ** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him
190180 ** up. we set BREAK. Once we will be ready to send again we will remove
191181 ** it.
192182 */
193− if (priv->config.break_control && nu->tty->ops->break_ctl)
183+ if (priv->config.break_control && nu->tty->ops->break_ctl) {
194184 nu->tty->ops->break_ctl(nu->tty, -1);
185+ usleep_range(1000, 3000);
186+ }
195187 }
196188
197189 static struct nci_uart nfcmrvl_nci_uart = {
include/linux/netdevice.h+1−0
@@ -1322,6 +1322,7 @@ enum netdev_priv_flags { · 1321 unmodified lines
13221322 #define IFF_L3MDEV_MASTER IFF_L3MDEV_MASTER
13231323 #define IFF_NO_QUEUE IFF_NO_QUEUE
13241324 #define IFF_OPENVSWITCH IFF_OPENVSWITCH
1325+#define IFF_L3MDEV_SLAVE IFF_L3MDEV_SLAVE
13251326
13261327 /**
13271328 * 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
397397 queue->fastopenq.max_qlen = min_t(unsigned int, backlog, somaxconn);
398398 }
399399
400+static 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+
400407 static inline void tcp_saved_syn_free(struct tcp_sock *tp)
401408 {
402409 kfree(tp->saved_syn);
include/net/bluetooth/l2cap.h+2−0
@@ -275,6 +275,8 @@ struct l2cap_conn_rsp { · 274 unmodified lines
275275 #define L2CAP_CR_AUTHORIZATION 0x0006
276276 #define L2CAP_CR_BAD_KEY_SIZE 0x0007
277277 #define L2CAP_CR_ENCRYPTION 0x0008
278+#define L2CAP_CR_INVALID_SCID 0x0009
279+#define L2CAP_CR_SCID_IN_USE 0x0010
278280
279281 /* connect/create channel status */
280282 #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
6363 static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)
6464 {
6565 struct metadata_dst *md_dst = skb_metadata_dst(skb);
66− int md_size = md_dst->u.tun_info.options_len;
66+ int md_size;
6767 struct metadata_dst *new_md;
6868
6969 if (!md_dst)
7070 return ERR_PTR(-EINVAL);
7171
72+ md_size = md_dst->u.tun_info.options_len;
7273 new_md = metadata_dst_alloc(md_size, GFP_ATOMIC);
7374 if (!new_md)
7475 return ERR_PTR(-ENOMEM);
include/net/inet_sock.h+12−0
@@ -210,6 +210,18 @@ struct inet_sock { · 209 unmodified lines
210210 #define IP_CMSG_ORIGDSTADDR BIT(6)
211211 #define IP_CMSG_CHECKSUM BIT(7)
212212
213+/* SYNACK messages might be attached to request sockets.
214+ * Some places want to reach the listener in this case.
215+ */
216+static 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+
213225 static inline struct inet_sock *inet_sk(const struct sock *sk)
214226 {
215227 return (struct inet_sock *)sk;
kernel/trace/Kconfig+1−1
@@ -434,7 +434,7 @@ config UPROBE_EVENT · 433 unmodified lines
434434
435435 config BPF_EVENTS
436436 depends on BPF_SYSCALL
437− depends on KPROBE_EVENT || UPROBE_EVENT
437+ depends on (KPROBE_EVENT || UPROBE_EVENT) && PERF_EVENTS
438438 bool
439439 default y
440440 help
lib/test_bpf.c+30−0
@@ -5055,6 +5055,36 @@ static struct bpf_test tests[] = { · 5054 unmodified lines
50555055 {},
50565056 { {0x1, 0x0 } },
50575057 },
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+ },
50585088 {
50595089 "JMP EQ default A",
50605090 .u.insns = {
net/bluetooth/hci_core.c+11−6
@@ -508,12 +508,6 @@ static void le_setup(struct hci_request *req) · 507 unmodified lines
508508 /* Read LE Supported States */
509509 hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);
510510
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−
517511 /* LE-only controllers have LE implicitly enabled */
518512 if (!lmp_bredr_capable(hdev))
519513 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
832826 hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
833827 }
834828
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+
835840 if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) {
836841 /* Read LE Maximum Data Length */
837842 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
239239 else
240240 dyn_end = L2CAP_CID_DYN_END;
241241
242− for (cid = L2CAP_CID_DYN_START; cid < dyn_end; cid++) {
242+ for (cid = L2CAP_CID_DYN_START; cid <= dyn_end; cid++) {
243243 if (!__l2cap_get_chan_by_scid(conn, cid))
244244 return cid;
245245 }
@@ -5250,7 +5250,9 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn, · 5004 unmodified lines
52505250 credits = __le16_to_cpu(rsp->credits);
52515251 result = __le16_to_cpu(rsp->result);
52525252
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))
52545256 return -EPROTO;
52555257
52565258 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
52705272
52715273 switch (result) {
52725274 case L2CAP_CR_SUCCESS:
5275+ if (__l2cap_get_chan_by_dcid(conn, dcid)) {
5276+ err = -EBADSLT;
5277+ break;
5278+ }
5279+
52735280 chan->ident = 0;
52745281 chan->dcid = dcid;
52755282 chan->omtu = mtu;
@@ -5437,9 +5444,16 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, · 161 unmodified lines
54375444 goto response_unlock;
54385445 }
54395446
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+
54405454 /* Check if we already have channel with that dcid */
54415455 if (__l2cap_get_chan_by_dcid(conn, scid)) {
5442− result = L2CAP_CR_NO_MEM;
5456+ result = L2CAP_CR_SCID_IN_USE;
54435457 chan = NULL;
54445458 goto response_unlock;
54455459 }
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
600600 int br_set_forward_delay(struct net_bridge *br, unsigned long val)
601601 {
602602 unsigned long t = clock_t_to_jiffies(val);
603−
604− if (t < BR_MIN_FORWARD_DELAY || t > BR_MAX_FORWARD_DELAY)
605− return -ERANGE;
603+ int err = -ERANGE;
606604
607605 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+
608610 __br_set_forward_delay(br, t);
611+ err = 0;
612+
613+unlock:
609614 spin_unlock_bh(&br->lock);
610− return 0;
615+ return err;
611616 }
net/core/dev.c+4−3
@@ -6402,7 +6402,7 @@ int __netdev_update_features(struct net_device *dev) · 6401 unmodified lines
64026402 struct net_device *upper, *lower;
64036403 netdev_features_t features;
64046404 struct list_head *iter;
6405− int err = 0;
6405+ int err = -1;
64066406
64076407 ASSERT_RTNL();
64086408
@@ -6419,7 +6419,7 @@ int __netdev_update_features(struct net_device *dev) · 10 unmodified lines
64196419 features = netdev_sync_upper_features(dev, upper, features);
64206420
64216421 if (dev->features == features)
6422− return 0;
6422+ goto sync_lower;
64236423
64246424 netdev_dbg(dev, "Features changed: %pNF -> %pNF\n",
64256425 &dev->features, &features);
@@ -6434,6 +6434,7 @@ int __netdev_update_features(struct net_device *dev) · 8 unmodified lines
64346434 return -1;
64356435 }
64366436
6437+sync_lower:
64376438 /* some features must be disabled on lower devices when disabled
64386439 * on an upper device (think: bonding master or bridge)
64396440 */
@@ -6443,7 +6444,7 @@ int __netdev_update_features(struct net_device *dev) · 3 unmodified lines
64436444 if (!err)
64446445 dev->features = features;
64456446
6446− return 1;
6447+ return err < 0 ? 0 : 1;
64476448 }
64486449
64496450 /**
net/core/dst.c+1−1
@@ -306,7 +306,7 @@ void dst_release(struct dst_entry *dst) · 305 unmodified lines
306306 if (unlikely(newrefcnt < 0))
307307 net_warn_ratelimited("%s: dst:%p refcnt:%d\n",
308308 __func__, dst, newrefcnt);
309− if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
309+ if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE))
310310 call_rcu(&dst->rcu_head, dst_destroy_rcu);
311311 }
312312 }
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
923923 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
924924 fib_prefsrc != cfg->fc_dst) {
925925 u32 tb_id = cfg->fc_table;
926+ int rc;
926927
927928 if (tb_id == RT_TABLE_MAIN)
928929 tb_id = RT_TABLE_LOCAL;
929930
930− if (inet_addr_type_table(cfg->fc_nlinfo.nl_net,
931− fib_prefsrc, tb_id) != RTN_LOCAL) {
932− return false;
931+ rc = inet_addr_type_table(cfg->fc_nlinfo.nl_net,
932+ fib_prefsrc, tb_id);
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);
933937 }
938+
939+ if (rc != RTN_LOCAL)
940+ return false;
934941 }
935942 return true;
936943 }
net/ipv4/igmp.c+4−8
@@ -2392,11 +2392,11 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, · 2391 unmodified lines
23922392 struct ip_sf_socklist *psl;
23932393 struct net *net = sock_net(sk);
23942394
2395+ ASSERT_RTNL();
2396+
23952397 if (!ipv4_is_multicast(addr))
23962398 return -EINVAL;
23972399
2398− rtnl_lock();
2399−
24002400 imr.imr_multiaddr.s_addr = msf->imsf_multiaddr;
24012401 imr.imr_address.s_addr = msf->imsf_interface;
24022402 imr.imr_ifindex = 0;
@@ -2417,7 +2417,6 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, · 14 unmodified lines
24172417 goto done;
24182418 msf->imsf_fmode = pmc->sfmode;
24192419 psl = rtnl_dereference(pmc->sflist);
2420− rtnl_unlock();
24212420 if (!psl) {
24222421 len = 0;
24232422 count = 0;
@@ -2436,7 +2435,6 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, · 12 unmodified lines
24362435 return -EFAULT;
24372436 return 0;
24382437 done:
2439− rtnl_unlock();
24402438 return err;
24412439 }
24422440
@@ -2450,6 +2448,8 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 7 unmodified lines
24502448 struct inet_sock *inet = inet_sk(sk);
24512449 struct ip_sf_socklist *psl;
24522450
2451+ ASSERT_RTNL();
2452+
24532453 psin = (struct sockaddr_in *)&gsf->gf_group;
24542454 if (psin->sin_family != AF_INET)
24552455 return -EINVAL;
@@ -2457,8 +2457,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 1 unmodified line
24572457 if (!ipv4_is_multicast(addr))
24582458 return -EINVAL;
24592459
2460− rtnl_lock();
2461−
24622460 err = -EADDRNOTAVAIL;
24632461
24642462 for_each_pmc_rtnl(inet, pmc) {
@@ -2470,7 +2468,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 5 unmodified lines
24702468 goto done;
24712469 gsf->gf_fmode = pmc->sfmode;
24722470 psl = rtnl_dereference(pmc->sflist);
2473− rtnl_unlock();
24742471 count = psl ? psl->sl_count : 0;
24752472 copycount = count < gsf->gf_numsrc ? count : gsf->gf_numsrc;
24762473 gsf->gf_numsrc = count;
@@ -2490,7 +2487,6 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, · 13 unmodified lines
24902487 }
24912488 return 0;
24922489 done:
2493− rtnl_unlock();
24942490 return err;
24952491 }
24962492
net/ipv4/ip_sockglue.c+30−15
@@ -1251,11 +1251,22 @@ EXPORT_SYMBOL(compat_ip_setsockopt); · 1250 unmodified lines
12511251 * the _received_ ones. The set sets the _sent_ ones.
12521252 */
12531253
1254+static 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+
12541264 static int do_ip_getsockopt(struct sock *sk, int level, int optname,
12551265 char __user *optval, int __user *optlen, unsigned int flags)
12561266 {
12571267 struct inet_sock *inet = inet_sk(sk);
1258− int val;
1268+ bool needs_rtnl = getsockopt_needs_rtnl(optname);
1269+ int val, err = 0;
12591270 int len;
12601271
12611272 if (level != SOL_IP)
@@ -1269,6 +1280,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, · 7 unmodified lines
12691280 if (len < 0)
12701281 return -EINVAL;
12711282
1283+ if (needs_rtnl)
1284+ rtnl_lock();
12721285 lock_sock(sk);
12731286
12741287 switch (optname) {
@@ -1386,39 +1399,35 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, · 111 unmodified lines
13861399 case IP_MSFILTER:
13871400 {
13881401 struct ip_msfilter msf;
1389− int err;
13901402
13911403 if (len < IP_MSFILTER_SIZE(0)) {
1392− release_sock(sk);
1393− return -EINVAL;
1404+ err = -EINVAL;
1405+ goto out;
13941406 }
13951407 if (copy_from_user(&msf, optval, IP_MSFILTER_SIZE(0))) {
1396− release_sock(sk);
1397− return -EFAULT;
1408+ err = -EFAULT;
1409+ goto out;
13981410 }
13991411 err = ip_mc_msfget(sk, &msf,
14001412 (struct ip_msfilter __user *)optval, optlen);
1401− release_sock(sk);
1402− return err;
1413+ goto out;
14031414 }
14041415 case MCAST_MSFILTER:
14051416 {
14061417 struct group_filter gsf;
1407− int err;
14081418
14091419 if (len < GROUP_FILTER_SIZE(0)) {
1410− release_sock(sk);
1411− return -EINVAL;
1420+ err = -EINVAL;
1421+ goto out;
14121422 }
14131423 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) {
1414− release_sock(sk);
1415− return -EFAULT;
1424+ err = -EFAULT;
1425+ goto out;
14161426 }
14171427 err = ip_mc_gsfget(sk, &gsf,
14181428 (struct group_filter __user *)optval,
14191429 optlen);
1420− release_sock(sk);
1421− return err;
1430+ goto out;
14221431 }
14231432 case IP_MULTICAST_ALL:
14241433 val = inet->mc_all;
@@ -1485,6 +1494,12 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, · 60 unmodified lines
14851494 return -EFAULT;
14861495 }
14871496 return 0;
1497+
1498+out:
1499+ release_sock(sk);
1500+ if (needs_rtnl)
1501+ rtnl_unlock();
1502+ return err;
14881503 }
14891504
14901505 int 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
6767 const struct nf_hook_state *state)
6868 {
6969 struct sock *sk = skb->sk;
70− struct inet_sock *inet = inet_sk(skb->sk);
7170
72− if (sk && (sk->sk_family == PF_INET) &&
73− inet->nodefrag)
71+ if (sk && sk_fullsock(sk) && (sk->sk_family == PF_INET) &&
72+ inet_sk(sk)->nodefrag)
7473 return NF_ACCEPT;
7574
7675 #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
4848 {
4949 bool same_parity = !((range[0] ^ range[1]) & 1);
5050
51− write_seqlock(&net->ipv4.ip_local_ports.lock);
51+ write_seqlock_bh(&net->ipv4.ip_local_ports.lock);
5252 if (same_parity && !net->ipv4.ip_local_ports.warned) {
5353 net->ipv4.ip_local_ports.warned = true;
5454 pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n");
5555 }
5656 net->ipv4.ip_local_ports.range[0] = range[0];
5757 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);
5959 }
6060
6161 /* 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
13261326 if (__inet_inherit_port(sk, newsk) < 0)
13271327 goto put_and_exit;
13281328 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
1329+ if (*own_req)
1330+ tcp_move_syn(newtp, req);
13291331
13301332 return newsk;
13311333
net/ipv4/tcp_minisocks.c+0−3
@@ -551,9 +551,6 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 550 unmodified lines
551551 newtp->rack.mstamp.v64 = 0;
552552 newtp->rack.advanced = 0;
553553
554− newtp->saved_syn = req->saved_syn;
555− req->saved_syn = NULL;
556−
557554 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS);
558555 }
559556 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
418418 if (err) {
419419 ipv6_mc_destroy_dev(ndev);
420420 del_timer(&ndev->regen_timer);
421+ snmp6_unregister_dev(ndev);
421422 goto err_release;
422423 }
423424 /* 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
11401140 goto out;
11411141 }
11421142 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
1143− /* Clone pktoptions received with SYN, if we own the req */
1144− if (*own_req && ireq->pktopts) {
1145− newnp->pktoptions = skb_clone(ireq->pktopts,
1146− sk_gfp_atomic(sk, GFP_ATOMIC));
1147− consume_skb(ireq->pktopts);
1148− ireq->pktopts = NULL;
1149− if (newnp->pktoptions)
1150− skb_set_owner_r(newnp->pktoptions, newsk);
1143+ if (*own_req) {
1144+ tcp_move_syn(newtp, req);
1145+
1146+ /* Clone pktoptions received with SYN, if we own the req */
1147+ if (ireq->pktopts) {
1148+ newnp->pktoptions = skb_clone(ireq->pktopts,
1149+ sk_gfp_atomic(sk, GFP_ATOMIC));
1150+ consume_skb(ireq->pktopts);
1151+ ireq->pktopts = NULL;
1152+ if (newnp->pktoptions)
1153+ skb_set_owner_r(newnp->pktoptions, newsk);
1154+ }
11511155 }
11521156
11531157 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
5555
5656 rcu_read_lock();
5757 indev = __in_dev_get_rcu(skb->dev);
58− if (indev != NULL) {
58+ if (indev && indev->ifa_list) {
5959 ifa = indev->ifa_list;
6060 newdst = ifa->ifa_local;
6161 }
net/netfilter/nfnetlink.c+1−1
@@ -492,7 +492,7 @@ static int nfnetlink_bind(struct net *net, int group) · 491 unmodified lines
492492 type = nfnl_group2type[group];
493493
494494 rcu_read_lock();
495− ss = nfnetlink_get_subsys(type);
495+ ss = nfnetlink_get_subsys(type << 8);
496496 rcu_read_unlock();
497497 if (!ss)
498498 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
3131 const struct nft_meta *priv = nft_expr_priv(expr);
3232 const struct sk_buff *skb = pkt->skb;
3333 const struct net_device *in = pkt->in, *out = pkt->out;
34+ struct sock *sk;
3435 u32 *dest = &regs->data[priv->dreg];
3536
3637 switch (priv->key) {
@@ -86,33 +87,35 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 49 unmodified lines
8687 *(u16 *)dest = out->type;
8788 break;
8889 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))
9092 goto err;
9193
92− read_lock_bh(&skb->sk->sk_callback_lock);
93− if (skb->sk->sk_socket == NULL ||
94− skb->sk->sk_socket->file == NULL) {
95− read_unlock_bh(&skb->sk->sk_callback_lock);
94+ read_lock_bh(&sk->sk_callback_lock);
95+ if (sk->sk_socket == NULL ||
96+ sk->sk_socket->file == NULL) {
97+ read_unlock_bh(&sk->sk_callback_lock);
9698 goto err;
9799 }
98100
99101 *dest = from_kuid_munged(&init_user_ns,
100− skb->sk->sk_socket->file->f_cred->fsuid);
101− read_unlock_bh(&skb->sk->sk_callback_lock);
102+ sk->sk_socket->file->f_cred->fsuid);
103+ read_unlock_bh(&sk->sk_callback_lock);
102104 break;
103105 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))
105108 goto err;
106109
107− read_lock_bh(&skb->sk->sk_callback_lock);
108− if (skb->sk->sk_socket == NULL ||
109− skb->sk->sk_socket->file == NULL) {
110− read_unlock_bh(&skb->sk->sk_callback_lock);
110+ read_lock_bh(&sk->sk_callback_lock);
111+ if (sk->sk_socket == NULL ||
112+ sk->sk_socket->file == NULL) {
113+ read_unlock_bh(&sk->sk_callback_lock);
111114 goto err;
112115 }
113116 *dest = from_kgid_munged(&init_user_ns,
114− skb->sk->sk_socket->file->f_cred->fsgid);
115− read_unlock_bh(&skb->sk->sk_callback_lock);
117+ sk->sk_socket->file->f_cred->fsgid);
118+ read_unlock_bh(&sk->sk_callback_lock);
116119 break;
117120 #ifdef CONFIG_IP_ROUTE_CLASSID
118121 case NFT_META_RTCLASSID: {
@@ -168,9 +171,10 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 49 unmodified lines
168171 break;
169172 #ifdef CONFIG_CGROUP_NET_CLASSID
170173 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))
172176 goto err;
173− *dest = skb->sk->sk_classid;
177+ *dest = sk->sk_classid;
174178 break;
175179 #endif
176180 default:
net/netfilter/xt_TEE.c+4−2
@@ -31,8 +31,9 @@ static unsigned int · 30 unmodified lines
3131 tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)
3232 {
3333 const struct xt_tee_tginfo *info = par->targinfo;
34+ int oif = info->priv ? info->priv->oif : 0;
3435
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);
3637
3738 return XT_CONTINUE;
3839 }
@@ -42,8 +43,9 @@ static unsigned int · 3 unmodified lines
4243 tee_tg6(struct sk_buff *skb, const struct xt_action_param *par)
4344 {
4445 const struct xt_tee_tginfo *info = par->targinfo;
46+ int oif = info->priv ? info->priv->oif : 0;
4547
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);
4749
4850 return XT_CONTINUE;
4951 }
net/netfilter/xt_owner.c+4−2
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/skbuff.h>
1515 #include <linux/file.h>
1616 #include <net/sock.h>
17+#include <net/inet_sock.h>
1718 #include <linux/netfilter/x_tables.h>
1819 #include <linux/netfilter/xt_owner.h>
1920
@@ -33,8 +34,9 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) · 13 unmodified lines
3334 {
3435 const struct xt_owner_match_info *info = par->matchinfo;
3536 const struct file *filp;
37+ struct sock *sk = skb_to_full_sk(skb);
3638
37− if (skb->sk == NULL || skb->sk->sk_socket == NULL)
39+ if (sk == NULL || sk->sk_socket == NULL)
3840 return (info->match ^ info->invert) == 0;
3941 else if (info->match & info->invert & XT_OWNER_SOCKET)
4042 /*
@@ -43,7 +45,7 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par) · 2 unmodified lines
4345 */
4446 return false;
4547
46− filp = skb->sk->sk_socket->file;
48+ filp = sk->sk_socket->file;
4749 if (filp == NULL)
4850 return ((info->match ^ info->invert) &
4951 (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
29112911 * Attach a packet hook.
29122912 */
29132913
2914−static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
2914+static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
2915+ __be16 proto)
29152916 {
29162917 struct packet_sock *po = pkt_sk(sk);
29172918 struct net_device *dev_curr;
29182919 __be16 proto_curr;
29192920 bool need_rehook;
2921+ struct net_device *dev = NULL;
2922+ int ret = 0;
2923+ bool unlisted = false;
29202924
2921− if (po->fanout) {
2922− if (dev)
2923− dev_put(dev);
2924−
2925+ if (po->fanout)
29252926 return -EINVAL;
2926− }
29272927
29282928 lock_sock(sk);
29292929 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);
29302948
29312949 proto_curr = po->prot_hook.type;
29322950 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
29342952 need_rehook = proto_curr != proto || dev_curr != dev;
29352953
29362954 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+ }
29382964
29392965 po->num = proto;
29402966 po->prot_hook.type = proto;
2941− po->prot_hook.dev = dev;
29422967
2943− po->ifindex = dev ? dev->ifindex : 0;
2944− packet_cached_dev_assign(po, dev);
2968+ if (unlikely(unlisted)) {
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+ }
29452978 }
29462979 if (dev_curr)
29472980 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
29492982 if (proto == 0 || !need_rehook)
29502983 goto out_unlock;
29512984
2952− if (!dev || (dev->flags & IFF_UP)) {
2985+ if (!unlisted && (!dev || (dev->flags & IFF_UP))) {
29532986 register_prot_hook(sk);
29542987 } else {
29552988 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
29582991 }
29592992
29602993 out_unlock:
2994+ rcu_read_unlock();
29612995 spin_unlock(&po->bind_lock);
29622996 release_sock(sk);
2963− return 0;
2997+ return ret;
29642998 }
29652999
29663000 /*
@@ -2972,8 +3006,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, · 5 unmodified lines
29723006 {
29733007 struct sock *sk = sock->sk;
29743008 char name[15];
2975− struct net_device *dev;
2976− int err = -ENODEV;
29773009
29783010 /*
29793011 * Check legality
@@ -2983,19 +3015,13 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, · 3 unmodified lines
29833015 return -EINVAL;
29843016 strlcpy(name, uaddr->sa_data, sizeof(name));
29853017
2986− dev = dev_get_by_name(sock_net(sk), name);
2987− if (dev)
2988− err = packet_do_bind(sk, dev, pkt_sk(sk)->num);
2989− return err;
3018+ return packet_do_bind(sk, name, 0, pkt_sk(sk)->num);
29903019 }
29913020
29923021 static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
29933022 {
29943023 struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr;
29953024 struct sock *sk = sock->sk;
2996− struct net_device *dev = NULL;
2997− int err;
2998−
29993025
30003026 /*
30013027 * Check legality
@@ -3006,16 +3032,8 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len · 4 unmodified lines
30063032 if (sll->sll_family != AF_PACKET)
30073033 return -EINVAL;
30083034
3009− if (sll->sll_ifindex) {
3010− err = -ENODEV;
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−
3017−out:
3018− return err;
3035+ return packet_do_bind(sk, NULL, sll->sll_ifindex,
3036+ sll->sll_protocol ? : pkt_sk(sk)->num);
30193037 }
30203038
30213039 static struct proto packet_proto = {
net/sched/cls_flow.c+11−4
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/if_vlan.h>
2323 #include <linux/slab.h>
2424 #include <linux/module.h>
25+#include <net/inet_sock.h>
2526
2627 #include <net/pkt_cls.h>
2728 #include <net/ip.h>
@@ -197,8 +198,11 @@ static u32 flow_get_rtclassid(const struct sk_buff *skb) · 169 unmodified lines
197198
198199 static u32 flow_get_skuid(const struct sk_buff *skb)
199200 {
200− if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) {
201− kuid_t skuid = skb->sk->sk_socket->file->f_cred->fsuid;
201+ struct sock *sk = skb_to_full_sk(skb);
202+
203+ if (sk && sk->sk_socket && sk->sk_socket->file) {
204+ kuid_t skuid = sk->sk_socket->file->f_cred->fsuid;
205+
202206 return from_kuid(&init_user_ns, skuid);
203207 }
204208 return 0;
@@ -206,8 +210,11 @@ static u32 flow_get_skuid(const struct sk_buff *skb) · 1 unmodified line
206210
207211 static u32 flow_get_skgid(const struct sk_buff *skb)
208212 {
209− if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) {
210− kgid_t skgid = skb->sk->sk_socket->file->f_cred->fsgid;
213+ struct sock *sk = skb_to_full_sk(skb);
214+
215+ if (sk && sk->sk_socket && sk->sk_socket->file) {
216+ kgid_t skgid = sk->sk_socket->file->f_cred->fsgid;
217+
211218 return from_kgid(&init_user_ns, skgid);
212219 }
213220 return 0;
net/sched/em_meta.c+92−46
@@ -343,119 +343,145 @@ META_COLLECTOR(int_sk_refcnt) · 342 unmodified lines
343343
344344 META_COLLECTOR(int_sk_rcvbuf)
345345 {
346− if (skip_nonlocal(skb)) {
346+ const struct sock *sk = skb_to_full_sk(skb);
347+
348+ if (!sk) {
347349 *err = -1;
348350 return;
349351 }
350− dst->value = skb->sk->sk_rcvbuf;
352+ dst->value = sk->sk_rcvbuf;
351353 }
352354
353355 META_COLLECTOR(int_sk_shutdown)
354356 {
355− if (skip_nonlocal(skb)) {
357+ const struct sock *sk = skb_to_full_sk(skb);
358+
359+ if (!sk) {
356360 *err = -1;
357361 return;
358362 }
359− dst->value = skb->sk->sk_shutdown;
363+ dst->value = sk->sk_shutdown;
360364 }
361365
362366 META_COLLECTOR(int_sk_proto)
363367 {
364− if (skip_nonlocal(skb)) {
368+ const struct sock *sk = skb_to_full_sk(skb);
369+
370+ if (!sk) {
365371 *err = -1;
366372 return;
367373 }
368− dst->value = skb->sk->sk_protocol;
374+ dst->value = sk->sk_protocol;
369375 }
370376
371377 META_COLLECTOR(int_sk_type)
372378 {
373− if (skip_nonlocal(skb)) {
379+ const struct sock *sk = skb_to_full_sk(skb);
380+
381+ if (!sk) {
374382 *err = -1;
375383 return;
376384 }
377− dst->value = skb->sk->sk_type;
385+ dst->value = sk->sk_type;
378386 }
379387
380388 META_COLLECTOR(int_sk_rmem_alloc)
381389 {
382− if (skip_nonlocal(skb)) {
390+ const struct sock *sk = skb_to_full_sk(skb);
391+
392+ if (!sk) {
383393 *err = -1;
384394 return;
385395 }
386− dst->value = sk_rmem_alloc_get(skb->sk);
396+ dst->value = sk_rmem_alloc_get(sk);
387397 }
388398
389399 META_COLLECTOR(int_sk_wmem_alloc)
390400 {
391− if (skip_nonlocal(skb)) {
401+ const struct sock *sk = skb_to_full_sk(skb);
402+
403+ if (!sk) {
392404 *err = -1;
393405 return;
394406 }
395− dst->value = sk_wmem_alloc_get(skb->sk);
407+ dst->value = sk_wmem_alloc_get(sk);
396408 }
397409
398410 META_COLLECTOR(int_sk_omem_alloc)
399411 {
400− if (skip_nonlocal(skb)) {
412+ const struct sock *sk = skb_to_full_sk(skb);
413+
414+ if (!sk) {
401415 *err = -1;
402416 return;
403417 }
404− dst->value = atomic_read(&skb->sk->sk_omem_alloc);
418+ dst->value = atomic_read(&sk->sk_omem_alloc);
405419 }
406420
407421 META_COLLECTOR(int_sk_rcv_qlen)
408422 {
409− if (skip_nonlocal(skb)) {
423+ const struct sock *sk = skb_to_full_sk(skb);
424+
425+ if (!sk) {
410426 *err = -1;
411427 return;
412428 }
413− dst->value = skb->sk->sk_receive_queue.qlen;
429+ dst->value = sk->sk_receive_queue.qlen;
414430 }
415431
416432 META_COLLECTOR(int_sk_snd_qlen)
417433 {
418− if (skip_nonlocal(skb)) {
434+ const struct sock *sk = skb_to_full_sk(skb);
435+
436+ if (!sk) {
419437 *err = -1;
420438 return;
421439 }
422− dst->value = skb->sk->sk_write_queue.qlen;
440+ dst->value = sk->sk_write_queue.qlen;
423441 }
424442
425443 META_COLLECTOR(int_sk_wmem_queued)
426444 {
427− if (skip_nonlocal(skb)) {
445+ const struct sock *sk = skb_to_full_sk(skb);
446+
447+ if (!sk) {
428448 *err = -1;
429449 return;
430450 }
431− dst->value = skb->sk->sk_wmem_queued;
451+ dst->value = sk->sk_wmem_queued;
432452 }
433453
434454 META_COLLECTOR(int_sk_fwd_alloc)
435455 {
436− if (skip_nonlocal(skb)) {
456+ const struct sock *sk = skb_to_full_sk(skb);
457+
458+ if (!sk) {
437459 *err = -1;
438460 return;
439461 }
440− dst->value = skb->sk->sk_forward_alloc;
462+ dst->value = sk->sk_forward_alloc;
441463 }
442464
443465 META_COLLECTOR(int_sk_sndbuf)
444466 {
445− if (skip_nonlocal(skb)) {
467+ const struct sock *sk = skb_to_full_sk(skb);
468+
469+ if (!sk) {
446470 *err = -1;
447471 return;
448472 }
449− dst->value = skb->sk->sk_sndbuf;
473+ dst->value = sk->sk_sndbuf;
450474 }
451475
452476 META_COLLECTOR(int_sk_alloc)
453477 {
454− if (skip_nonlocal(skb)) {
478+ const struct sock *sk = skb_to_full_sk(skb);
479+
480+ if (!sk) {
455481 *err = -1;
456482 return;
457483 }
458− dst->value = (__force int) skb->sk->sk_allocation;
484+ dst->value = (__force int) sk->sk_allocation;
459485 }
460486
461487 META_COLLECTOR(int_sk_hash)
@@ -469,92 +495,112 @@ META_COLLECTOR(int_sk_hash) · 7 unmodified lines
469495
470496 META_COLLECTOR(int_sk_lingertime)
471497 {
472− if (skip_nonlocal(skb)) {
498+ const struct sock *sk = skb_to_full_sk(skb);
499+
500+ if (!sk) {
473501 *err = -1;
474502 return;
475503 }
476− dst->value = skb->sk->sk_lingertime / HZ;
504+ dst->value = sk->sk_lingertime / HZ;
477505 }
478506
479507 META_COLLECTOR(int_sk_err_qlen)
480508 {
481− if (skip_nonlocal(skb)) {
509+ const struct sock *sk = skb_to_full_sk(skb);
510+
511+ if (!sk) {
482512 *err = -1;
483513 return;
484514 }
485− dst->value = skb->sk->sk_error_queue.qlen;
515+ dst->value = sk->sk_error_queue.qlen;
486516 }
487517
488518 META_COLLECTOR(int_sk_ack_bl)
489519 {
490− if (skip_nonlocal(skb)) {
520+ const struct sock *sk = skb_to_full_sk(skb);
521+
522+ if (!sk) {
491523 *err = -1;
492524 return;
493525 }
494− dst->value = skb->sk->sk_ack_backlog;
526+ dst->value = sk->sk_ack_backlog;
495527 }
496528
497529 META_COLLECTOR(int_sk_max_ack_bl)
498530 {
499− if (skip_nonlocal(skb)) {
531+ const struct sock *sk = skb_to_full_sk(skb);
532+
533+ if (!sk) {
500534 *err = -1;
501535 return;
502536 }
503− dst->value = skb->sk->sk_max_ack_backlog;
537+ dst->value = sk->sk_max_ack_backlog;
504538 }
505539
506540 META_COLLECTOR(int_sk_prio)
507541 {
508− if (skip_nonlocal(skb)) {
542+ const struct sock *sk = skb_to_full_sk(skb);
543+
544+ if (!sk) {
509545 *err = -1;
510546 return;
511547 }
512− dst->value = skb->sk->sk_priority;
548+ dst->value = sk->sk_priority;
513549 }
514550
515551 META_COLLECTOR(int_sk_rcvlowat)
516552 {
517− if (skip_nonlocal(skb)) {
553+ const struct sock *sk = skb_to_full_sk(skb);
554+
555+ if (!sk) {
518556 *err = -1;
519557 return;
520558 }
521− dst->value = skb->sk->sk_rcvlowat;
559+ dst->value = sk->sk_rcvlowat;
522560 }
523561
524562 META_COLLECTOR(int_sk_rcvtimeo)
525563 {
526− if (skip_nonlocal(skb)) {
564+ const struct sock *sk = skb_to_full_sk(skb);
565+
566+ if (!sk) {
527567 *err = -1;
528568 return;
529569 }
530− dst->value = skb->sk->sk_rcvtimeo / HZ;
570+ dst->value = sk->sk_rcvtimeo / HZ;
531571 }
532572
533573 META_COLLECTOR(int_sk_sndtimeo)
534574 {
535− if (skip_nonlocal(skb)) {
575+ const struct sock *sk = skb_to_full_sk(skb);
576+
577+ if (!sk) {
536578 *err = -1;
537579 return;
538580 }
539− dst->value = skb->sk->sk_sndtimeo / HZ;
581+ dst->value = sk->sk_sndtimeo / HZ;
540582 }
541583
542584 META_COLLECTOR(int_sk_sendmsg_off)
543585 {
544− if (skip_nonlocal(skb)) {
586+ const struct sock *sk = skb_to_full_sk(skb);
587+
588+ if (!sk) {
545589 *err = -1;
546590 return;
547591 }
548− dst->value = skb->sk->sk_frag.offset;
592+ dst->value = sk->sk_frag.offset;
549593 }
550594
551595 META_COLLECTOR(int_sk_write_pend)
552596 {
553− if (skip_nonlocal(skb)) {
597+ const struct sock *sk = skb_to_full_sk(skb);
598+
599+ if (!sk) {
554600 *err = -1;
555601 return;
556602 }
557− dst->value = skb->sk->sk_write_pending;
603+ dst->value = sk->sk_write_pending;
558604 }
559605
560606 /**************************************************************************
net/vmw_vsock/vmci_transport.c+1−1
@@ -1234,7 +1234,7 @@ vmci_transport_recv_connecting_server(struct sock *listener, · 1233 unmodified lines
12341234 /* Callers of accept() will be be waiting on the listening socket, not
12351235 * the pending socket.
12361236 */
1237− listener->sk_state_change(listener);
1237+ listener->sk_data_ready(listener);
12381238
12391239 return 0;
12401240
security/selinux/hooks.c+2−4
@@ -4933,7 +4933,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, · 4932 unmodified lines
49334933 int ifindex,
49344934 u16 family)
49354935 {
4936− struct sock *sk = skb->sk;
4936+ struct sock *sk = skb_to_full_sk(skb);
49374937 struct sk_security_struct *sksec;
49384938 struct common_audit_data ad;
49394939 struct lsm_network_audit net = {0,};
@@ -4988,7 +4988,7 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, · 48 unmodified lines
49884988 if (!secmark_active && !peerlbl_active)
49894989 return NF_ACCEPT;
49904990
4991− sk = skb->sk;
4991+ sk = skb_to_full_sk(skb);
49924992
49934993 #ifdef CONFIG_XFRM
49944994 /* 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
50335033 u32 skb_sid;
50345034 struct sk_security_struct *sksec;
50355035
5036− if (sk->sk_state == TCP_NEW_SYN_RECV)
5037− sk = inet_reqsk(sk)->rsk_listener;
50385036 sksec = sk->sk_security;
50395037 if (selinux_skb_peerlbl_sid(skb, family, &skb_sid))
50405038 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
245245
246246 /* if this is a locally generated packet check to see if it is already
247247 * being labeled by it's parent socket, if it is just exit */
248− sk = skb->sk;
248+ sk = skb_to_full_sk(skb);
249249 if (sk != NULL) {
250250 struct sk_security_struct *sksec = sk->sk_security;
251251 if (sksec->nlbl_state != NLBL_REQSKB)
security/smack/smack_netfilter.c+7−4
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/netfilter_ipv4.h>
1818 #include <linux/netfilter_ipv6.h>
1919 #include <linux/netdevice.h>
20+#include <net/inet_sock.h>
2021 #include "smack.h"
2122
2223 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -25,11 +26,12 @@ static unsigned int smack_ipv6_output(void *priv, · 2 unmodified lines
2526 struct sk_buff *skb,
2627 const struct nf_hook_state *state)
2728 {
29+ struct sock *sk = skb_to_full_sk(skb);
2830 struct socket_smack *ssp;
2931 struct smack_known *skp;
3032
31− if (skb && skb->sk && skb->sk->sk_security) {
32− ssp = skb->sk->sk_security;
33+ if (sk && sk->sk_security) {
34+ ssp = sk->sk_security;
3335 skp = ssp->smk_out;
3436 skb->secmark = skp->smk_secid;
3537 }
@@ -42,11 +44,12 @@ static unsigned int smack_ipv4_output(void *priv, · 6 unmodified lines
4244 struct sk_buff *skb,
4345 const struct nf_hook_state *state)
4446 {
47+ struct sock *sk = skb_to_full_sk(skb);
4548 struct socket_smack *ssp;
4649 struct smack_known *skp;
4750
48− if (skb && skb->sk && skb->sk->sk_security) {
49− ssp = skb->sk->sk_security;
51+ if (sk && sk->sk_security) {
52+ ssp = sk->sk_security;
5053 skp = ssp->smk_out;
5154 skb->secmark = skp->smk_secid;
5255 }

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