History

Merge tag 'net-5.17-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski: "Including fixes from netfilter, ipsec, and wireless. A few last minute revert / disable and fix patches came down from our sub-trees. We're not waiting for any fixes at this point. Current release - regressions: - Revert "netfilter: nat: force port remap to prevent shadowing well-known ports", restore working conntrack on asymmetric paths - Revert "ath10k: drop beacon and probe response which leak from other channel", restore working AP and mesh mode on QCA9984 - eth: intel: fix hang during reboot/shutdown Current release - new code bugs: - netfilter: nf_tables: disable register tracking, it needs more work to cover all corner cases Previous releases - regressions: - ipv6: fix skb_over_panic in __ip6_append_data when (admin-only) extension headers get specified - esp6: fix ESP over TCP/UDP, interpret ipv6_skip_exthdr's return value more selectively - bnx2x: fix driver load failure when FW not present in initrd Previous releases - always broken: - vsock: stop destroying unrelated sockets in nested virtualization - packet: fix slab-out-of-bounds access in packet_recvmsg() Misc: - add Paolo Abeni to networking maintainers!" * tag 'net-5.17-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (26 commits) iavf: Fix hang during reboot/shutdown net: mscc: ocelot: fix backwards compatibility with single-chain tc-flower offload net: bcmgenet: skip invalid partial checksums bnx2x: fix built-in kernel driver load failure net: phy: mscc: Add MODULE_FIRMWARE macros net: dsa: Add missing of_node_put() in dsa_port_parse_of net: handle ARPHRD_PIMREG in dev_is_mac_header_xmit() Revert "ath10k: drop beacon and probe response which leak from other channel" hv_netvsc: Add check for kvmalloc_array iavf: Fix double free in iavf_reset_task ice: destroy flow director filter mutex after releasing VSIs ice: fix NULL pointer dereference in ice_update_vsi_tx_ring_stats() Add Paolo Abeni to networking maintainers atm: eni: Add check for dma_map_single net/packet: fix slab-out-of-bounds access in packet_recvmsg() net: mdio: mscc-miim: fix duplicate debugfs entry net: phy: marvell: Fix invalid comparison in the resume and suspend functions esp6: fix check on ipv6_skip_exthdr's return value net: dsa: microchip: add spi_device_id tables netfilter: nf_tables: disable register tracking ...

Linus Torvalds committed 4 years ago

Commit 551acdc2 parents c81801e b04683f33 files · +154 −133Browse files

Unified · Split

33 files
  1. MAINTAINERS +2 −0
  2. drivers/atm/eni.c +2 −0
  3. drivers/net/dsa/microchip/ksz8795_spi.c +11 −0
  4. drivers/net/dsa/microchip/ksz9477_spi.c +12 −0
  5. drivers/net/ethernet/atheros/alx/main.c +4 −1
  6. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +0 −2
  7. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +17 −11
  8. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +2 −13
  9. drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 −2
  10. drivers/net/ethernet/intel/iavf/iavf_main.c +14 −1
  11. drivers/net/ethernet/intel/ice/ice_main.c +4 −3
  12. drivers/net/ethernet/mscc/ocelot_flower.c +15 −1
  13. drivers/net/hyperv/netvsc_drv.c +3 −0
  14. drivers/net/mdio/mdio-mscc-miim.c +8 −1
  15. drivers/net/phy/marvell.c +4 −4
  16. drivers/net/phy/mscc/mscc_main.c +3 −0
  17. drivers/net/wireless/ath/ath10k/wmi.c +1 −32
  18. drivers/vhost/vsock.c +2 −1
  19. include/linux/if_arp.h +1 −0
  20. include/net/af_vsock.h +2 −1
  21. include/net/netfilter/nf_conntrack.h +0 −1
  22. net/dsa/dsa2.c +1 −0
  23. net/ipv6/esp6.c +1 −2
  24. net/ipv6/ip6_output.c +2 −2
  25. net/key/af_key.c +1 −1
  26. net/netfilter/nf_conntrack_core.c +0 −3
  27. net/netfilter/nf_nat_core.c +3 −40
  28. net/netfilter/nf_tables_api.c +7 −2
  29. net/packet/af_packet.c +10 −1
  30. net/vmw_vsock/af_vsock.c +7 −2
  31. net/vmw_vsock/virtio_transport.c +5 −2
  32. net/vmw_vsock/vmci_transport.c +4 −1
  33. tools/testing/selftests/netfilter/nft_nat.sh +2 −3
MAINTAINERS+2−0
@@ -13376,6 +13376,7 @@ F: net/core/drop_monitor.c · 13375 unmodified lines
1337613376 NETWORKING DRIVERS
1337713377 M: "David S. Miller" <davem@davemloft.net>
1337813378 M: Jakub Kicinski <kuba@kernel.org>
13379+M: Paolo Abeni <pabeni@redhat.com>
1337913380 L: netdev@vger.kernel.org
1338013381 S: Maintained
1338113382 Q: https://patchwork.kernel.org/project/netdevbpf/list/
@@ -13422,6 +13423,7 @@ F: tools/testing/selftests/drivers/net/dsa/ · 40 unmodified lines
1342213423 NETWORKING [GENERAL]
1342313424 M: "David S. Miller" <davem@davemloft.net>
1342413425 M: Jakub Kicinski <kuba@kernel.org>
13426+M: Paolo Abeni <pabeni@redhat.com>
1342513427 L: netdev@vger.kernel.org
1342613428 S: Maintained
1342713429 Q: https://patchwork.kernel.org/project/netdevbpf/list/
drivers/atm/eni.c+2−0
@@ -1112,6 +1112,8 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags); · 1111 unmodified lines
11121112 skb_data3 = skb->data[3];
11131113 paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len,
11141114 DMA_TO_DEVICE);
1115+ if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr))
1116+ return enq_next;
11151117 ENI_PRV_PADDR(skb) = paddr;
11161118 /* prepare DMA queue entries */
11171119 j = 0;
drivers/net/dsa/microchip/ksz8795_spi.c+11−0
@@ -124,12 +124,23 @@ static const struct of_device_id ksz8795_dt_ids[] = { · 123 unmodified lines
124124 };
125125 MODULE_DEVICE_TABLE(of, ksz8795_dt_ids);
126126
127+static const struct spi_device_id ksz8795_spi_ids[] = {
128+ { "ksz8765" },
129+ { "ksz8794" },
130+ { "ksz8795" },
131+ { "ksz8863" },
132+ { "ksz8873" },
133+ { },
134+};
135+MODULE_DEVICE_TABLE(spi, ksz8795_spi_ids);
136+
127137 static struct spi_driver ksz8795_spi_driver = {
128138 .driver = {
129139 .name = "ksz8795-switch",
130140 .owner = THIS_MODULE,
131141 .of_match_table = of_match_ptr(ksz8795_dt_ids),
132142 },
143+ .id_table = ksz8795_spi_ids,
133144 .probe = ksz8795_spi_probe,
134145 .remove = ksz8795_spi_remove,
135146 .shutdown = ksz8795_spi_shutdown,
drivers/net/dsa/microchip/ksz9477_spi.c+12−0
@@ -98,12 +98,24 @@ static const struct of_device_id ksz9477_dt_ids[] = { · 97 unmodified lines
9898 };
9999 MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
100100
101+static const struct spi_device_id ksz9477_spi_ids[] = {
102+ { "ksz9477" },
103+ { "ksz9897" },
104+ { "ksz9893" },
105+ { "ksz9563" },
106+ { "ksz8563" },
107+ { "ksz9567" },
108+ { },
109+};
110+MODULE_DEVICE_TABLE(spi, ksz9477_spi_ids);
111+
101112 static struct spi_driver ksz9477_spi_driver = {
102113 .driver = {
103114 .name = "ksz9477-switch",
104115 .owner = THIS_MODULE,
105116 .of_match_table = of_match_ptr(ksz9477_dt_ids),
106117 },
118+ .id_table = ksz9477_spi_ids,
107119 .probe = ksz9477_spi_probe,
108120 .remove = ksz9477_spi_remove,
109121 .shutdown = ksz9477_spi_shutdown,
drivers/net/ethernet/atheros/alx/main.c+4−1
@@ -1181,8 +1181,11 @@ static int alx_change_mtu(struct net_device *netdev, int mtu) · 1180 unmodified lines
11811181 alx->hw.mtu = mtu;
11821182 alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);
11831183 netdev_update_features(netdev);
1184− if (netif_running(netdev))
1184+ if (netif_running(netdev)) {
1185+ mutex_lock(&alx->mtx);
11851186 alx_reinit(alx);
1187+ mutex_unlock(&alx->mtx);
1188+ }
11861189 return 0;
11871190 }
11881191
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+0−2
@@ -2533,6 +2533,4 @@ void bnx2x_register_phc(struct bnx2x *bp); · 2532 unmodified lines
25332533 * Meant for implicit re-load flows.
25342534 */
25352535 int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp);
2536−int bnx2x_init_firmware(struct bnx2x *bp);
2537−void bnx2x_release_firmware(struct bnx2x *bp);
25382536 #endif /* bnx2x.h */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+17−11
@@ -2364,24 +2364,30 @@ int bnx2x_compare_fw_ver(struct bnx2x *bp, u32 load_code, bool print_err) · 2363 unmodified lines
23642364 /* is another pf loaded on this engine? */
23652365 if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
23662366 load_code != FW_MSG_CODE_DRV_LOAD_COMMON) {
2367− /* build my FW version dword */
2368− u32 my_fw = (bp->fw_major) + (bp->fw_minor << 8) +
2369− (bp->fw_rev << 16) + (bp->fw_eng << 24);
2367+ u8 loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng;
2368+ u32 loaded_fw;
23702369
23712370 /* read loaded FW from chip */
2372− u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
2371+ loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
23732372
2374− DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x\n",
2375− loaded_fw, my_fw);
2373+ loaded_fw_major = loaded_fw & 0xff;
2374+ loaded_fw_minor = (loaded_fw >> 8) & 0xff;
2375+ loaded_fw_rev = (loaded_fw >> 16) & 0xff;
2376+ loaded_fw_eng = (loaded_fw >> 24) & 0xff;
2377+
2378+ DP(BNX2X_MSG_SP, "loaded fw 0x%x major 0x%x minor 0x%x rev 0x%x eng 0x%x\n",
2379+ loaded_fw, loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng);
23762380
23772381 /* abort nic load if version mismatch */
2378− if (my_fw != loaded_fw) {
2382+ if (loaded_fw_major != BCM_5710_FW_MAJOR_VERSION ||
2383+ loaded_fw_minor != BCM_5710_FW_MINOR_VERSION ||
2384+ loaded_fw_eng != BCM_5710_FW_ENGINEERING_VERSION ||
2385+ loaded_fw_rev < BCM_5710_FW_REVISION_VERSION_V15) {
23792386 if (print_err)
2380− BNX2X_ERR("bnx2x with FW %x was already loaded which mismatches my %x FW. Aborting\n",
2381− loaded_fw, my_fw);
2387+ BNX2X_ERR("loaded FW incompatible. Aborting\n");
23822388 else
2383− BNX2X_DEV_INFO("bnx2x with FW %x was already loaded which mismatches my %x FW, possibly due to MF UNDI\n",
2384− loaded_fw, my_fw);
2389+ BNX2X_DEV_INFO("loaded FW incompatible, possibly due to MF UNDI\n");
2390+
23852391 return -EBUSY;
23862392 }
23872393 }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+2−13
@@ -12319,15 +12319,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 12318 unmodified lines
1231912319
1232012320 bnx2x_read_fwinfo(bp);
1232112321
12322− if (IS_PF(bp)) {
12323− rc = bnx2x_init_firmware(bp);
12324−
12325− if (rc) {
12326− bnx2x_free_mem_bp(bp);
12327− return rc;
12328− }
12329− }
12330−
1233112322 func = BP_FUNC(bp);
1233212323
1233312324 /* need to reset chip if undi was active */
@@ -12340,7 +12331,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 6 unmodified lines
1234012331
1234112332 rc = bnx2x_prev_unload(bp);
1234212333 if (rc) {
12343− bnx2x_release_firmware(bp);
1234412334 bnx2x_free_mem_bp(bp);
1234512335 return rc;
1234612336 }
@@ -13409,7 +13399,7 @@ do { \ · 1062 unmodified lines
1340913399 (u8 *)bp->arr, len); \
1341013400 } while (0)
1341113401
13412−int bnx2x_init_firmware(struct bnx2x *bp)
13402+static int bnx2x_init_firmware(struct bnx2x *bp)
1341313403 {
1341413404 const char *fw_file_name, *fw_file_name_v15;
1341513405 struct bnx2x_fw_file_hdr *fw_hdr;
@@ -13509,7 +13499,7 @@ request_firmware_exit: · 93 unmodified lines
1350913499 return rc;
1351013500 }
1351113501
13512−void bnx2x_release_firmware(struct bnx2x *bp)
13502+static void bnx2x_release_firmware(struct bnx2x *bp)
1351313503 {
1351413504 kfree(bp->init_ops_offsets);
1351513505 kfree(bp->init_ops);
@@ -14026,7 +14016,6 @@ static int bnx2x_init_one(struct pci_dev *pdev, · 510 unmodified lines
1402614016 return 0;
1402714017
1402814018 init_one_freemem:
14029− bnx2x_release_firmware(bp);
1403014019 bnx2x_free_mem_bp(bp);
1403114020
1403214021 init_one_exit:
drivers/net/ethernet/broadcom/genet/bcmgenet.c+4−2
@@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, · 2286 unmodified lines
22872287 dma_length_status = status->length_status;
22882288 if (dev->features & NETIF_F_RXCSUM) {
22892289 rx_csum = (__force __be16)(status->rx_csum & 0xffff);
2290− skb->csum = (__force __wsum)ntohs(rx_csum);
2291− skb->ip_summed = CHECKSUM_COMPLETE;
2290+ if (rx_csum) {
2291+ skb->csum = (__force __wsum)ntohs(rx_csum);
2292+ skb->ip_summed = CHECKSUM_COMPLETE;
2293+ }
22922294 }
22932295
22942296 /* DMA flags and length are still valid no matter how
drivers/net/ethernet/intel/iavf/iavf_main.c+14−1
@@ -2541,6 +2541,13 @@ restart_watchdog: · 2540 unmodified lines
25412541 queue_delayed_work(iavf_wq, &adapter->watchdog_task, HZ * 2);
25422542 }
25432543
2544+/**
2545+ * iavf_disable_vf - disable VF
2546+ * @adapter: board private structure
2547+ *
2548+ * Set communication failed flag and free all resources.
2549+ * NOTE: This function is expected to be called with crit_lock being held.
2550+ **/
25442551 static void iavf_disable_vf(struct iavf_adapter *adapter)
25452552 {
25462553 struct iavf_mac_filter *f, *ftmp;
@@ -2595,7 +2602,6 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) · 48 unmodified lines
25952602 memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
25962603 iavf_shutdown_adminq(&adapter->hw);
25972604 adapter->netdev->flags &= ~IFF_UP;
2598− mutex_unlock(&adapter->crit_lock);
25992605 adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
26002606 iavf_change_state(adapter, __IAVF_DOWN);
26012607 wake_up(&adapter->down_waitqueue);
@@ -4614,6 +4620,13 @@ static void iavf_remove(struct pci_dev *pdev) · 2012 unmodified lines
46144620 struct iavf_hw *hw = &adapter->hw;
46154621 int err;
46164622
4623+ /* When reboot/shutdown is in progress no need to do anything
4624+ * as the adapter is already REMOVE state that was set during
4625+ * iavf_shutdown() callback.
4626+ */
4627+ if (adapter->state == __IAVF_REMOVE)
4628+ return;
4629+
46174630 set_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section);
46184631 /* Wait until port initialization is complete.
46194632 * There are flows where register/unregister netdev may race.
drivers/net/ethernet/intel/ice/ice_main.c+4−3
@@ -4880,7 +4880,6 @@ static void ice_remove(struct pci_dev *pdev) · 4879 unmodified lines
48804880 ice_devlink_unregister_params(pf);
48814881 set_bit(ICE_DOWN, pf->state);
48824882
4883− mutex_destroy(&(&pf->hw)->fdir_fltr_lock);
48844883 ice_deinit_lag(pf);
48854884 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags))
48864885 ice_ptp_release(pf);
@@ -4888,6 +4887,7 @@ static void ice_remove(struct pci_dev *pdev) · 1 unmodified line
48884887 ice_remove_arfs(pf);
48894888 ice_setup_mc_magic_wake(pf);
48904889 ice_vsi_release_all(pf);
4890+ mutex_destroy(&(&pf->hw)->fdir_fltr_lock);
48914891 ice_set_wake(pf);
48924892 ice_free_irq_msix_misc(pf);
48934893 ice_for_each_vsi(pf, i) {
@@ -5962,8 +5962,9 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, · 1068 unmodified lines
59625962 u64 pkts = 0, bytes = 0;
59635963
59645964 ring = READ_ONCE(rings[i]);
5965− if (ring)
5966− ice_fetch_u64_stats_per_ring(&ring->syncp, ring->stats, &pkts, &bytes);
5965+ if (!ring)
5966+ continue;
5967+ ice_fetch_u64_stats_per_ring(&ring->syncp, ring->stats, &pkts, &bytes);
59675968 vsi_stats->tx_packets += pkts;
59685969 vsi_stats->tx_bytes += bytes;
59695970 vsi->tx_restart += ring->tx_stats.restart_q;
drivers/net/ethernet/mscc/ocelot_flower.c+15−1
@@ -60,6 +60,12 @@ static int ocelot_chain_to_block(int chain, bool ingress) · 59 unmodified lines
6060 */
6161 static int ocelot_chain_to_lookup(int chain)
6262 {
63+ /* Backwards compatibility with older, single-chain tc-flower
64+ * offload support in Ocelot
65+ */
66+ if (chain == 0)
67+ return 0;
68+
6369 return (chain / VCAP_LOOKUP) % 10;
6470 }
6571
@@ -68,7 +74,15 @@ static int ocelot_chain_to_lookup(int chain) · 2 unmodified lines
6874 */
6975 static int ocelot_chain_to_pag(int chain)
7076 {
71− int lookup = ocelot_chain_to_lookup(chain);
77+ int lookup;
78+
79+ /* Backwards compatibility with older, single-chain tc-flower
80+ * offload support in Ocelot
81+ */
82+ if (chain == 0)
83+ return 0;
84+
85+ lookup = ocelot_chain_to_lookup(chain);
7286
7387 /* calculate PAG value as chain index relative to the first PAG */
7488 return chain - VCAP_IS2_CHAIN(lookup, 0);
drivers/net/hyperv/netvsc_drv.c+3−0
@@ -1587,6 +1587,9 @@ static void netvsc_get_ethtool_stats(struct net_device *dev, · 1586 unmodified lines
15871587 pcpu_sum = kvmalloc_array(num_possible_cpus(),
15881588 sizeof(struct netvsc_ethtool_pcpu_stats),
15891589 GFP_KERNEL);
1590+ if (!pcpu_sum)
1591+ return;
1592+
15901593 netvsc_get_pcpu_stats(dev, pcpu_sum);
15911594 for_each_present_cpu(cpu) {
15921595 struct netvsc_ethtool_pcpu_stats *this_sum = &pcpu_sum[cpu];
drivers/net/mdio/mdio-mscc-miim.c+8−1
@@ -187,6 +187,13 @@ static const struct regmap_config mscc_miim_regmap_config = { · 186 unmodified lines
187187 .reg_stride = 4,
188188 };
189189
190+static const struct regmap_config mscc_miim_phy_regmap_config = {
191+ .reg_bits = 32,
192+ .val_bits = 32,
193+ .reg_stride = 4,
194+ .name = "phy",
195+};
196+
190197 int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
191198 struct regmap *mii_regmap, int status_offset)
192199 {
@@ -250,7 +257,7 @@ static int mscc_miim_probe(struct platform_device *pdev) · 57 unmodified lines
250257 }
251258
252259 phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs,
253− &mscc_miim_regmap_config);
260+ &mscc_miim_phy_regmap_config);
254261 if (IS_ERR(phy_regmap)) {
255262 dev_err(&pdev->dev, "Unable to create phy register regmap\n");
256263 return PTR_ERR(phy_regmap);
drivers/net/phy/marvell.c+4−4
@@ -1687,8 +1687,8 @@ static int marvell_suspend(struct phy_device *phydev) · 1686 unmodified lines
16871687 int err;
16881688
16891689 /* Suspend the fiber mode first */
1690− if (!linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
1691− phydev->supported)) {
1690+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
1691+ phydev->supported)) {
16921692 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE);
16931693 if (err < 0)
16941694 goto error;
@@ -1722,8 +1722,8 @@ static int marvell_resume(struct phy_device *phydev) · 27 unmodified lines
17221722 int err;
17231723
17241724 /* Resume the fiber mode first */
1725− if (!linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
1726− phydev->supported)) {
1725+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
1726+ phydev->supported)) {
17271727 err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE);
17281728 if (err < 0)
17291729 goto error;
drivers/net/phy/mscc/mscc_main.c+3−0
@@ -2685,3 +2685,6 @@ MODULE_DEVICE_TABLE(mdio, vsc85xx_tbl); · 2684 unmodified lines
26852685 MODULE_DESCRIPTION("Microsemi VSC85xx PHY driver");
26862686 MODULE_AUTHOR("Nagaraju Lakkaraju");
26872687 MODULE_LICENSE("Dual MIT/GPL");
2688+
2689+MODULE_FIRMWARE(MSCC_VSC8584_REVB_INT8051_FW);
2690+MODULE_FIRMWARE(MSCC_VSC8574_REVB_INT8051_FW);
drivers/net/wireless/ath/ath10k/wmi.c+1−32
@@ -2611,36 +2611,9 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) · 2610 unmodified lines
26112611 ath10k_mac_handle_beacon(ar, skb);
26122612
26132613 if (ieee80211_is_beacon(hdr->frame_control) ||
2614− ieee80211_is_probe_resp(hdr->frame_control)) {
2615− struct ieee80211_mgmt *mgmt = (void *)skb->data;
2616− enum cfg80211_bss_frame_type ftype;
2617− u8 *ies;
2618− int ies_ch;
2619−
2614+ ieee80211_is_probe_resp(hdr->frame_control))
26202615 status->boottime_ns = ktime_get_boottime_ns();
26212616
2622− if (!ar->scan_channel)
2623− goto drop;
2624−
2625− ies = mgmt->u.beacon.variable;
2626−
2627− if (ieee80211_is_beacon(mgmt->frame_control))
2628− ftype = CFG80211_BSS_FTYPE_BEACON;
2629− else
2630− ftype = CFG80211_BSS_FTYPE_PRESP;
2631−
2632− ies_ch = cfg80211_get_ies_channel_number(mgmt->u.beacon.variable,
2633− skb_tail_pointer(skb) - ies,
2634− sband->band, ftype);
2635−
2636− if (ies_ch > 0 && ies_ch != channel) {
2637− ath10k_dbg(ar, ATH10K_DBG_MGMT,
2638− "channel mismatched ds channel %d scan channel %d\n",
2639− ies_ch, channel);
2640− goto drop;
2641− }
2642− }
2643−
26442617 ath10k_dbg(ar, ATH10K_DBG_MGMT,
26452618 "event mgmt rx skb %pK len %d ftype %02x stype %02x\n",
26462619 skb, skb->len,
@@ -2654,10 +2627,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) · 7 unmodified lines
26542627 ieee80211_rx_ni(ar->hw, skb);
26552628
26562629 return 0;
2657−
2658−drop:
2659− dev_kfree_skb(skb);
2660− return 0;
26612630 }
26622631
26632632 static int freq_to_idx(struct ath10k *ar, int freq)
drivers/vhost/vsock.c+2−1
@@ -753,7 +753,8 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file) · 752 unmodified lines
753753
754754 /* Iterating over all connections for all CIDs to find orphans is
755755 * inefficient. Room for improvement here. */
756− vsock_for_each_connected_socket(vhost_vsock_reset_orphans);
756+ vsock_for_each_connected_socket(&vhost_transport.transport,
757+ vhost_vsock_reset_orphans);
757758
758759 /* Don't check the owner, because we are in the release path, so we
759760 * need to stop the vsock device in any case.
include/linux/if_arp.h+1−0
@@ -52,6 +52,7 @@ static inline bool dev_is_mac_header_xmit(const struct net_device *dev) · 51 unmodified lines
5252 case ARPHRD_VOID:
5353 case ARPHRD_NONE:
5454 case ARPHRD_RAWIP:
55+ case ARPHRD_PIMREG:
5556 return false;
5657 default:
5758 return true;
include/net/af_vsock.h+2−1
@@ -205,7 +205,8 @@ struct sock *vsock_find_bound_socket(struct sockaddr_vm *addr); · 204 unmodified lines
205205 struct sock *vsock_find_connected_socket(struct sockaddr_vm *src,
206206 struct sockaddr_vm *dst);
207207 void vsock_remove_sock(struct vsock_sock *vsk);
208−void vsock_for_each_connected_socket(void (*fn)(struct sock *sk));
208+void vsock_for_each_connected_socket(struct vsock_transport *transport,
209+ void (*fn)(struct sock *sk));
209210 int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk);
210211 bool vsock_find_cid(unsigned int cid);
211212
include/net/netfilter/nf_conntrack.h+0−1
@@ -97,7 +97,6 @@ struct nf_conn { · 96 unmodified lines
9797 unsigned long status;
9898
9999 u16 cpu;
100− u16 local_origin:1;
101100 possible_net_t ct_net;
102101
103102 #if IS_ENABLED(CONFIG_NF_NAT)
net/dsa/dsa2.c+1−0
@@ -1436,6 +1436,7 @@ static int dsa_port_parse_of(struct dsa_port *dp, struct device_node *dn) · 1435 unmodified lines
14361436 const char *user_protocol;
14371437
14381438 master = of_find_net_device_by_node(ethernet);
1439+ of_node_put(ethernet);
14391440 if (!master)
14401441 return -EPROBE_DEFER;
14411442
net/ipv6/esp6.c+1−2
@@ -812,8 +812,7 @@ int esp6_input_done2(struct sk_buff *skb, int err) · 811 unmodified lines
812812 struct tcphdr *th;
813813
814814 offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off);
815−
816− if (offset < 0) {
815+ if (offset == -1) {
817816 err = -EINVAL;
818817 goto out;
819818 }
net/ipv6/ip6_output.c+2−2
@@ -1476,8 +1476,8 @@ static int __ip6_append_data(struct sock *sk, · 1475 unmodified lines
14761476 sizeof(struct frag_hdr) : 0) +
14771477 rt->rt6i_nfheader_len;
14781478
1479− if (mtu < fragheaderlen ||
1480− ((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr))
1479+ if (mtu <= fragheaderlen ||
1480+ ((mtu - fragheaderlen) & ~7) + fragheaderlen <= sizeof(struct frag_hdr))
14811481 goto emsgsize;
14821482
14831483 maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen -
net/key/af_key.c+1−1
@@ -1699,7 +1699,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad · 1698 unmodified lines
16991699
17001700 xfrm_probe_algs();
17011701
1702− supp_skb = compose_sadb_supported(hdr, GFP_KERNEL);
1702+ supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO);
17031703 if (!supp_skb) {
17041704 if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC)
17051705 pfk->registered &= ~(1<<hdr->sadb_msg_satype);
net/netfilter/nf_conntrack_core.c+0−3
@@ -1748,9 +1748,6 @@ resolve_normal_ct(struct nf_conn *tmpl, · 1747 unmodified lines
17481748 return 0;
17491749 if (IS_ERR(h))
17501750 return PTR_ERR(h);
1751−
1752− ct = nf_ct_tuplehash_to_ctrack(h);
1753− ct->local_origin = state->hook == NF_INET_LOCAL_OUT;
17541751 }
17551752 ct = nf_ct_tuplehash_to_ctrack(h);
17561753
net/netfilter/nf_nat_core.c+3−40
@@ -494,38 +494,6 @@ another_round: · 493 unmodified lines
494494 goto another_round;
495495 }
496496
497−static bool tuple_force_port_remap(const struct nf_conntrack_tuple *tuple)
498−{
499− u16 sp, dp;
500−
501− switch (tuple->dst.protonum) {
502− case IPPROTO_TCP:
503− sp = ntohs(tuple->src.u.tcp.port);
504− dp = ntohs(tuple->dst.u.tcp.port);
505− break;
506− case IPPROTO_UDP:
507− case IPPROTO_UDPLITE:
508− sp = ntohs(tuple->src.u.udp.port);
509− dp = ntohs(tuple->dst.u.udp.port);
510− break;
511− default:
512− return false;
513− }
514−
515− /* IANA: System port range: 1-1023,
516− * user port range: 1024-49151,
517− * private port range: 49152-65535.
518− *
519− * Linux default ephemeral port range is 32768-60999.
520− *
521− * Enforce port remapping if sport is significantly lower
522− * than dport to prevent NAT port shadowing, i.e.
523− * accidental match of 'new' inbound connection vs.
524− * existing outbound one.
525− */
526− return sp < 16384 && dp >= 32768;
527−}
528−
529497 /* Manipulate the tuple into the range given. For NF_INET_POST_ROUTING,
530498 * we change the source to map into the range. For NF_INET_PRE_ROUTING
531499 * and NF_INET_LOCAL_OUT, we change the destination to map into the
@@ -539,17 +507,11 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple, · 7 unmodified lines
539507 struct nf_conn *ct,
540508 enum nf_nat_manip_type maniptype)
541509 {
542− bool random_port = range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL;
543510 const struct nf_conntrack_zone *zone;
544511 struct net *net = nf_ct_net(ct);
545512
546513 zone = nf_ct_zone(ct);
547514
548− if (maniptype == NF_NAT_MANIP_SRC &&
549− !random_port &&
550− !ct->local_origin)
551− random_port = tuple_force_port_remap(orig_tuple);
552−
553515 /* 1) If this srcip/proto/src-proto-part is currently mapped,
554516 * and that same mapping gives a unique tuple within the given
555517 * range, use that.
@@ -558,7 +520,8 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple, · 2 unmodified lines
558520 * So far, we don't do local source mappings, so multiple
559521 * manips not an issue.
560522 */
561− if (maniptype == NF_NAT_MANIP_SRC && !random_port) {
523+ if (maniptype == NF_NAT_MANIP_SRC &&
524+ !(range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL)) {
562525 /* try the original tuple first */
563526 if (in_range(orig_tuple, range)) {
564527 if (!nf_nat_used_tuple(orig_tuple, ct)) {
@@ -582,7 +545,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple, · 17 unmodified lines
582545 */
583546
584547 /* Only bother mapping if it's not already in range and unique */
585− if (!random_port) {
548+ if (!(range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL)) {
586549 if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
587550 if (!(range->flags & NF_NAT_RANGE_PROTO_OFFSET) &&
588551 l4proto_in_range(tuple, maniptype,
net/netfilter/nf_tables_api.c+7−2
@@ -8260,6 +8260,12 @@ void nf_tables_trans_destroy_flush_work(void) · 8259 unmodified lines
82608260 }
82618261 EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work);
82628262
8263+static bool nft_expr_reduce(struct nft_regs_track *track,
8264+ const struct nft_expr *expr)
8265+{
8266+ return false;
8267+}
8268+
82638269 static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *chain)
82648270 {
82658271 const struct nft_expr *expr, *last;
@@ -8307,8 +8313,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha · 41 unmodified lines
83078313 nft_rule_for_each_expr(expr, last, rule) {
83088314 track.cur = expr;
83098315
8310− if (expr->ops->reduce &&
8311− expr->ops->reduce(&track, expr)) {
8316+ if (nft_expr_reduce(&track, expr)) {
83128317 expr = track.cur;
83138318 continue;
83148319 }
net/packet/af_packet.c+10−1
@@ -2317,8 +2317,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 2316 unmodified lines
23172317 copy_skb = skb_get(skb);
23182318 skb_head = skb->data;
23192319 }
2320− if (copy_skb)
2320+ if (copy_skb) {
2321+ memset(&PACKET_SKB_CB(copy_skb)->sa.ll, 0,
2322+ sizeof(PACKET_SKB_CB(copy_skb)->sa.ll));
23212323 skb_set_owner_r(copy_skb, sk);
2324+ }
23222325 }
23232326 snaplen = po->rx_ring.frame_size - macoff;
23242327 if ((int)snaplen < 0) {
@@ -3462,6 +3465,8 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 1137 unmodified lines
34623465 sock_recv_ts_and_drops(msg, sk, skb);
34633466
34643467 if (msg->msg_name) {
3468+ const size_t max_len = min(sizeof(skb->cb),
3469+ sizeof(struct sockaddr_storage));
34653470 int copy_len;
34663471
34673472 /* If the address length field is there to be filled
@@ -3484,6 +3489,10 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 16 unmodified lines
34843489 msg->msg_namelen = sizeof(struct sockaddr_ll);
34853490 }
34863491 }
3492+ if (WARN_ON_ONCE(copy_len > max_len)) {
3493+ copy_len = max_len;
3494+ msg->msg_namelen = copy_len;
3495+ }
34873496 memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len);
34883497 }
34893498
net/vmw_vsock/af_vsock.c+7−2
@@ -334,7 +334,8 @@ void vsock_remove_sock(struct vsock_sock *vsk) · 333 unmodified lines
334334 }
335335 EXPORT_SYMBOL_GPL(vsock_remove_sock);
336336
337−void vsock_for_each_connected_socket(void (*fn)(struct sock *sk))
337+void vsock_for_each_connected_socket(struct vsock_transport *transport,
338+ void (*fn)(struct sock *sk))
338339 {
339340 int i;
340341
@@ -343,8 +344,12 @@ void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) · 2 unmodified lines
343344 for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) {
344345 struct vsock_sock *vsk;
345346 list_for_each_entry(vsk, &vsock_connected_table[i],
346− connected_table)
347+ connected_table) {
348+ if (vsk->transport != transport)
349+ continue;
350+
347351 fn(sk_vsock(vsk));
352+ }
348353 }
349354
350355 spin_unlock_bh(&vsock_table_lock);
net/vmw_vsock/virtio_transport.c+5−2
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 static struct workqueue_struct *virtio_vsock_workqueue;
2525 static struct virtio_vsock __rcu *the_virtio_vsock;
2626 static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */
27+static struct virtio_transport virtio_transport; /* forward declaration */
2728
2829 struct virtio_vsock {
2930 struct virtio_device *vdev;
@@ -384,7 +385,8 @@ static void virtio_vsock_event_handle(struct virtio_vsock *vsock, · 354 unmodified lines
384385 switch (le32_to_cpu(event->id)) {
385386 case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET:
386387 virtio_vsock_update_guest_cid(vsock);
387− vsock_for_each_connected_socket(virtio_vsock_reset_sock);
388+ vsock_for_each_connected_socket(&virtio_transport.transport,
389+ virtio_vsock_reset_sock);
388390 break;
389391 }
390392 }
@@ -662,7 +664,8 @@ static void virtio_vsock_remove(struct virtio_device *vdev) · 271 unmodified lines
662664 synchronize_rcu();
663665
664666 /* Reset all connected sockets when the device disappear */
665− vsock_for_each_connected_socket(virtio_vsock_reset_sock);
667+ vsock_for_each_connected_socket(&virtio_transport.transport,
668+ virtio_vsock_reset_sock);
666669
667670 /* Stop all work handlers to make sure no one is accessing the device,
668671 * so we can safely call virtio_reset_device().
net/vmw_vsock/vmci_transport.c+4−1
@@ -75,6 +75,8 @@ static u32 vmci_transport_qp_resumed_sub_id = VMCI_INVALID_ID; · 74 unmodified lines
7575
7676 static int PROTOCOL_OVERRIDE = -1;
7777
78+static struct vsock_transport vmci_transport; /* forward declaration */
79+
7880 /* Helper function to convert from a VMCI error code to a VSock error code. */
7981
8082 static s32 vmci_transport_error_to_vsock_error(s32 vmci_error)
@@ -882,7 +884,8 @@ static void vmci_transport_qp_resumed_cb(u32 sub_id, · 801 unmodified lines
882884 const struct vmci_event_data *e_data,
883885 void *client_data)
884886 {
885− vsock_for_each_connected_socket(vmci_transport_handle_detach);
887+ vsock_for_each_connected_socket(&vmci_transport,
888+ vmci_transport_handle_detach);
886889 }
887890
888891 static void vmci_transport_recv_pkt_work(struct work_struct *work)
tools/testing/selftests/netfilter/nft_nat.sh+2−3
@@ -880,9 +880,8 @@ EOF · 879 unmodified lines
880880 return $ksft_skip
881881 fi
882882
883− # test default behaviour. Packet from ns1 to ns0 is not redirected
884− # due to automatic port translation.
885− test_port_shadow "default" "ROUTER"
883+ # test default behaviour. Packet from ns1 to ns0 is redirected to ns2.
884+ test_port_shadow "default" "CLIENT"
886885
887886 # test packet filter based mitigation: prevent forwarding of
888887 # packets claiming to come from the service port.

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