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 ...
Unified · Split
| @@ -13376,6 +13376,7 @@ F: net/core/drop_monitor.c · 13375 unmodified lines | ||
| 13376 | 13376 | NETWORKING DRIVERS |
| 13377 | 13377 | M: "David S. Miller" <davem@davemloft.net> |
| 13378 | 13378 | M: Jakub Kicinski <kuba@kernel.org> |
| 13379 | +M: Paolo Abeni <pabeni@redhat.com> | |
| 13379 | 13380 | L: netdev@vger.kernel.org |
| 13380 | 13381 | S: Maintained |
| 13381 | 13382 | Q: https://patchwork.kernel.org/project/netdevbpf/list/ |
| @@ -13422,6 +13423,7 @@ F: tools/testing/selftests/drivers/net/dsa/ · 40 unmodified lines | ||
| 13422 | 13423 | NETWORKING [GENERAL] |
| 13423 | 13424 | M: "David S. Miller" <davem@davemloft.net> |
| 13424 | 13425 | M: Jakub Kicinski <kuba@kernel.org> |
| 13426 | +M: Paolo Abeni <pabeni@redhat.com> | |
| 13425 | 13427 | L: netdev@vger.kernel.org |
| 13426 | 13428 | S: Maintained |
| 13427 | 13429 | Q: https://patchwork.kernel.org/project/netdevbpf/list/ |
| @@ -1112,6 +1112,8 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags); · 1111 unmodified lines | ||
| 1112 | 1112 | skb_data3 = skb->data[3]; |
| 1113 | 1113 | paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len, |
| 1114 | 1114 | DMA_TO_DEVICE); |
| 1115 | + if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr)) | |
| 1116 | + return enq_next; | |
| 1115 | 1117 | ENI_PRV_PADDR(skb) = paddr; |
| 1116 | 1118 | /* prepare DMA queue entries */ |
| 1117 | 1119 | j = 0; |
| @@ -124,12 +124,23 @@ static const struct of_device_id ksz8795_dt_ids[] = { · 123 unmodified lines | ||
| 124 | 124 | }; |
| 125 | 125 | MODULE_DEVICE_TABLE(of, ksz8795_dt_ids); |
| 126 | 126 | |
| 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 | + | |
| 127 | 137 | static struct spi_driver ksz8795_spi_driver = { |
| 128 | 138 | .driver = { |
| 129 | 139 | .name = "ksz8795-switch", |
| 130 | 140 | .owner = THIS_MODULE, |
| 131 | 141 | .of_match_table = of_match_ptr(ksz8795_dt_ids), |
| 132 | 142 | }, |
| 143 | + .id_table = ksz8795_spi_ids, | |
| 133 | 144 | .probe = ksz8795_spi_probe, |
| 134 | 145 | .remove = ksz8795_spi_remove, |
| 135 | 146 | .shutdown = ksz8795_spi_shutdown, |
| @@ -98,12 +98,24 @@ static const struct of_device_id ksz9477_dt_ids[] = { · 97 unmodified lines | ||
| 98 | 98 | }; |
| 99 | 99 | MODULE_DEVICE_TABLE(of, ksz9477_dt_ids); |
| 100 | 100 | |
| 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 | + | |
| 101 | 112 | static struct spi_driver ksz9477_spi_driver = { |
| 102 | 113 | .driver = { |
| 103 | 114 | .name = "ksz9477-switch", |
| 104 | 115 | .owner = THIS_MODULE, |
| 105 | 116 | .of_match_table = of_match_ptr(ksz9477_dt_ids), |
| 106 | 117 | }, |
| 118 | + .id_table = ksz9477_spi_ids, | |
| 107 | 119 | .probe = ksz9477_spi_probe, |
| 108 | 120 | .remove = ksz9477_spi_remove, |
| 109 | 121 | .shutdown = ksz9477_spi_shutdown, |
| @@ -1181,8 +1181,11 @@ static int alx_change_mtu(struct net_device *netdev, int mtu) · 1180 unmodified lines | ||
| 1181 | 1181 | alx->hw.mtu = mtu; |
| 1182 | 1182 | alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); |
| 1183 | 1183 | netdev_update_features(netdev); |
| 1184 | − if (netif_running(netdev)) | |
| 1184 | + if (netif_running(netdev)) { | |
| 1185 | + mutex_lock(&alx->mtx); | |
| 1185 | 1186 | alx_reinit(alx); |
| 1187 | + mutex_unlock(&alx->mtx); | |
| 1188 | + } | |
| 1186 | 1189 | return 0; |
| 1187 | 1190 | } |
| 1188 | 1191 | |
| @@ -2533,6 +2533,4 @@ void bnx2x_register_phc(struct bnx2x *bp); · 2532 unmodified lines | ||
| 2533 | 2533 | * Meant for implicit re-load flows. |
| 2534 | 2534 | */ |
| 2535 | 2535 | int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp); |
| 2536 | −int bnx2x_init_firmware(struct bnx2x *bp); | |
| 2537 | −void bnx2x_release_firmware(struct bnx2x *bp); | |
| 2538 | 2536 | #endif /* bnx2x.h */ |
| @@ -2364,24 +2364,30 @@ int bnx2x_compare_fw_ver(struct bnx2x *bp, u32 load_code, bool print_err) · 2363 unmodified lines | ||
| 2364 | 2364 | /* is another pf loaded on this engine? */ |
| 2365 | 2365 | if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && |
| 2366 | 2366 | 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; | |
| 2370 | 2369 | |
| 2371 | 2370 | /* read loaded FW from chip */ |
| 2372 | − u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); | |
| 2371 | + loaded_fw = REG_RD(bp, XSEM_REG_PRAM); | |
| 2373 | 2372 | |
| 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); | |
| 2376 | 2380 | |
| 2377 | 2381 | /* 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) { | |
| 2379 | 2386 | 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"); | |
| 2382 | 2388 | 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 | + | |
| 2385 | 2391 | return -EBUSY; |
| 2386 | 2392 | } |
| 2387 | 2393 | } |
| @@ -12319,15 +12319,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 12318 unmodified lines | ||
| 12319 | 12319 | |
| 12320 | 12320 | bnx2x_read_fwinfo(bp); |
| 12321 | 12321 | |
| 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 | − | |
| 12331 | 12322 | func = BP_FUNC(bp); |
| 12332 | 12323 | |
| 12333 | 12324 | /* need to reset chip if undi was active */ |
| @@ -12340,7 +12331,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) · 6 unmodified lines | ||
| 12340 | 12331 | |
| 12341 | 12332 | rc = bnx2x_prev_unload(bp); |
| 12342 | 12333 | if (rc) { |
| 12343 | − bnx2x_release_firmware(bp); | |
| 12344 | 12334 | bnx2x_free_mem_bp(bp); |
| 12345 | 12335 | return rc; |
| 12346 | 12336 | } |
| @@ -13409,7 +13399,7 @@ do { \ · 1062 unmodified lines | ||
| 13409 | 13399 | (u8 *)bp->arr, len); \ |
| 13410 | 13400 | } while (0) |
| 13411 | 13401 | |
| 13412 | −int bnx2x_init_firmware(struct bnx2x *bp) | |
| 13402 | +static int bnx2x_init_firmware(struct bnx2x *bp) | |
| 13413 | 13403 | { |
| 13414 | 13404 | const char *fw_file_name, *fw_file_name_v15; |
| 13415 | 13405 | struct bnx2x_fw_file_hdr *fw_hdr; |
| @@ -13509,7 +13499,7 @@ request_firmware_exit: · 93 unmodified lines | ||
| 13509 | 13499 | return rc; |
| 13510 | 13500 | } |
| 13511 | 13501 | |
| 13512 | −void bnx2x_release_firmware(struct bnx2x *bp) | |
| 13502 | +static void bnx2x_release_firmware(struct bnx2x *bp) | |
| 13513 | 13503 | { |
| 13514 | 13504 | kfree(bp->init_ops_offsets); |
| 13515 | 13505 | kfree(bp->init_ops); |
| @@ -14026,7 +14016,6 @@ static int bnx2x_init_one(struct pci_dev *pdev, · 510 unmodified lines | ||
| 14026 | 14016 | return 0; |
| 14027 | 14017 | |
| 14028 | 14018 | init_one_freemem: |
| 14029 | − bnx2x_release_firmware(bp); | |
| 14030 | 14019 | bnx2x_free_mem_bp(bp); |
| 14031 | 14020 | |
| 14032 | 14021 | init_one_exit: |
| @@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, · 2286 unmodified lines | ||
| 2287 | 2287 | dma_length_status = status->length_status; |
| 2288 | 2288 | if (dev->features & NETIF_F_RXCSUM) { |
| 2289 | 2289 | 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 | + } | |
| 2292 | 2294 | } |
| 2293 | 2295 | |
| 2294 | 2296 | /* DMA flags and length are still valid no matter how |
| @@ -2541,6 +2541,13 @@ restart_watchdog: · 2540 unmodified lines | ||
| 2541 | 2541 | queue_delayed_work(iavf_wq, &adapter->watchdog_task, HZ * 2); |
| 2542 | 2542 | } |
| 2543 | 2543 | |
| 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 | + **/ | |
| 2544 | 2551 | static void iavf_disable_vf(struct iavf_adapter *adapter) |
| 2545 | 2552 | { |
| 2546 | 2553 | struct iavf_mac_filter *f, *ftmp; |
| @@ -2595,7 +2602,6 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) · 48 unmodified lines | ||
| 2595 | 2602 | memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE); |
| 2596 | 2603 | iavf_shutdown_adminq(&adapter->hw); |
| 2597 | 2604 | adapter->netdev->flags &= ~IFF_UP; |
| 2598 | − mutex_unlock(&adapter->crit_lock); | |
| 2599 | 2605 | adapter->flags &= ~IAVF_FLAG_RESET_PENDING; |
| 2600 | 2606 | iavf_change_state(adapter, __IAVF_DOWN); |
| 2601 | 2607 | wake_up(&adapter->down_waitqueue); |
| @@ -4614,6 +4620,13 @@ static void iavf_remove(struct pci_dev *pdev) · 2012 unmodified lines | ||
| 4614 | 4620 | struct iavf_hw *hw = &adapter->hw; |
| 4615 | 4621 | int err; |
| 4616 | 4622 | |
| 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 | + | |
| 4617 | 4630 | set_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section); |
| 4618 | 4631 | /* Wait until port initialization is complete. |
| 4619 | 4632 | * There are flows where register/unregister netdev may race. |
| @@ -4880,7 +4880,6 @@ static void ice_remove(struct pci_dev *pdev) · 4879 unmodified lines | ||
| 4880 | 4880 | ice_devlink_unregister_params(pf); |
| 4881 | 4881 | set_bit(ICE_DOWN, pf->state); |
| 4882 | 4882 | |
| 4883 | − mutex_destroy(&(&pf->hw)->fdir_fltr_lock); | |
| 4884 | 4883 | ice_deinit_lag(pf); |
| 4885 | 4884 | if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) |
| 4886 | 4885 | ice_ptp_release(pf); |
| @@ -4888,6 +4887,7 @@ static void ice_remove(struct pci_dev *pdev) · 1 unmodified line | ||
| 4888 | 4887 | ice_remove_arfs(pf); |
| 4889 | 4888 | ice_setup_mc_magic_wake(pf); |
| 4890 | 4889 | ice_vsi_release_all(pf); |
| 4890 | + mutex_destroy(&(&pf->hw)->fdir_fltr_lock); | |
| 4891 | 4891 | ice_set_wake(pf); |
| 4892 | 4892 | ice_free_irq_msix_misc(pf); |
| 4893 | 4893 | ice_for_each_vsi(pf, i) { |
| @@ -5962,8 +5962,9 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, · 1068 unmodified lines | ||
| 5962 | 5962 | u64 pkts = 0, bytes = 0; |
| 5963 | 5963 | |
| 5964 | 5964 | 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); | |
| 5967 | 5968 | vsi_stats->tx_packets += pkts; |
| 5968 | 5969 | vsi_stats->tx_bytes += bytes; |
| 5969 | 5970 | vsi->tx_restart += ring->tx_stats.restart_q; |
| @@ -60,6 +60,12 @@ static int ocelot_chain_to_block(int chain, bool ingress) · 59 unmodified lines | ||
| 60 | 60 | */ |
| 61 | 61 | static int ocelot_chain_to_lookup(int chain) |
| 62 | 62 | { |
| 63 | + /* Backwards compatibility with older, single-chain tc-flower | |
| 64 | + * offload support in Ocelot | |
| 65 | + */ | |
| 66 | + if (chain == 0) | |
| 67 | + return 0; | |
| 68 | + | |
| 63 | 69 | return (chain / VCAP_LOOKUP) % 10; |
| 64 | 70 | } |
| 65 | 71 | |
| @@ -68,7 +74,15 @@ static int ocelot_chain_to_lookup(int chain) · 2 unmodified lines | ||
| 68 | 74 | */ |
| 69 | 75 | static int ocelot_chain_to_pag(int chain) |
| 70 | 76 | { |
| 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); | |
| 72 | 86 | |
| 73 | 87 | /* calculate PAG value as chain index relative to the first PAG */ |
| 74 | 88 | return chain - VCAP_IS2_CHAIN(lookup, 0); |
| @@ -1587,6 +1587,9 @@ static void netvsc_get_ethtool_stats(struct net_device *dev, · 1586 unmodified lines | ||
| 1587 | 1587 | pcpu_sum = kvmalloc_array(num_possible_cpus(), |
| 1588 | 1588 | sizeof(struct netvsc_ethtool_pcpu_stats), |
| 1589 | 1589 | GFP_KERNEL); |
| 1590 | + if (!pcpu_sum) | |
| 1591 | + return; | |
| 1592 | + | |
| 1590 | 1593 | netvsc_get_pcpu_stats(dev, pcpu_sum); |
| 1591 | 1594 | for_each_present_cpu(cpu) { |
| 1592 | 1595 | struct netvsc_ethtool_pcpu_stats *this_sum = &pcpu_sum[cpu]; |
| @@ -187,6 +187,13 @@ static const struct regmap_config mscc_miim_regmap_config = { · 186 unmodified lines | ||
| 187 | 187 | .reg_stride = 4, |
| 188 | 188 | }; |
| 189 | 189 | |
| 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 | + | |
| 190 | 197 | int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name, |
| 191 | 198 | struct regmap *mii_regmap, int status_offset) |
| 192 | 199 | { |
| @@ -250,7 +257,7 @@ static int mscc_miim_probe(struct platform_device *pdev) · 57 unmodified lines | ||
| 250 | 257 | } |
| 251 | 258 | |
| 252 | 259 | phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs, |
| 253 | − &mscc_miim_regmap_config); | |
| 260 | + &mscc_miim_phy_regmap_config); | |
| 254 | 261 | if (IS_ERR(phy_regmap)) { |
| 255 | 262 | dev_err(&pdev->dev, "Unable to create phy register regmap\n"); |
| 256 | 263 | return PTR_ERR(phy_regmap); |
| @@ -1687,8 +1687,8 @@ static int marvell_suspend(struct phy_device *phydev) · 1686 unmodified lines | ||
| 1687 | 1687 | int err; |
| 1688 | 1688 | |
| 1689 | 1689 | /* 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)) { | |
| 1692 | 1692 | err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); |
| 1693 | 1693 | if (err < 0) |
| 1694 | 1694 | goto error; |
| @@ -1722,8 +1722,8 @@ static int marvell_resume(struct phy_device *phydev) · 27 unmodified lines | ||
| 1722 | 1722 | int err; |
| 1723 | 1723 | |
| 1724 | 1724 | /* 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)) { | |
| 1727 | 1727 | err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); |
| 1728 | 1728 | if (err < 0) |
| 1729 | 1729 | goto error; |
| @@ -2685,3 +2685,6 @@ MODULE_DEVICE_TABLE(mdio, vsc85xx_tbl); · 2684 unmodified lines | ||
| 2685 | 2685 | MODULE_DESCRIPTION("Microsemi VSC85xx PHY driver"); |
| 2686 | 2686 | MODULE_AUTHOR("Nagaraju Lakkaraju"); |
| 2687 | 2687 | MODULE_LICENSE("Dual MIT/GPL"); |
| 2688 | + | |
| 2689 | +MODULE_FIRMWARE(MSCC_VSC8584_REVB_INT8051_FW); | |
| 2690 | +MODULE_FIRMWARE(MSCC_VSC8574_REVB_INT8051_FW); | |
| @@ -2611,36 +2611,9 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) · 2610 unmodified lines | ||
| 2611 | 2611 | ath10k_mac_handle_beacon(ar, skb); |
| 2612 | 2612 | |
| 2613 | 2613 | 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)) | |
| 2620 | 2615 | status->boottime_ns = ktime_get_boottime_ns(); |
| 2621 | 2616 | |
| 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 | − | |
| 2644 | 2617 | ath10k_dbg(ar, ATH10K_DBG_MGMT, |
| 2645 | 2618 | "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", |
| 2646 | 2619 | skb, skb->len, |
| @@ -2654,10 +2627,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb) · 7 unmodified lines | ||
| 2654 | 2627 | ieee80211_rx_ni(ar->hw, skb); |
| 2655 | 2628 | |
| 2656 | 2629 | return 0; |
| 2657 | − | |
| 2658 | −drop: | |
| 2659 | − dev_kfree_skb(skb); | |
| 2660 | − return 0; | |
| 2661 | 2630 | } |
| 2662 | 2631 | |
| 2663 | 2632 | static int freq_to_idx(struct ath10k *ar, int freq) |
| @@ -753,7 +753,8 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file) · 752 unmodified lines | ||
| 753 | 753 | |
| 754 | 754 | /* Iterating over all connections for all CIDs to find orphans is |
| 755 | 755 | * 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); | |
| 757 | 758 | |
| 758 | 759 | /* Don't check the owner, because we are in the release path, so we |
| 759 | 760 | * need to stop the vsock device in any case. |
| @@ -52,6 +52,7 @@ static inline bool dev_is_mac_header_xmit(const struct net_device *dev) · 51 unmodified lines | ||
| 52 | 52 | case ARPHRD_VOID: |
| 53 | 53 | case ARPHRD_NONE: |
| 54 | 54 | case ARPHRD_RAWIP: |
| 55 | + case ARPHRD_PIMREG: | |
| 55 | 56 | return false; |
| 56 | 57 | default: |
| 57 | 58 | return true; |
| @@ -205,7 +205,8 @@ struct sock *vsock_find_bound_socket(struct sockaddr_vm *addr); · 204 unmodified lines | ||
| 205 | 205 | struct sock *vsock_find_connected_socket(struct sockaddr_vm *src, |
| 206 | 206 | struct sockaddr_vm *dst); |
| 207 | 207 | 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)); | |
| 209 | 210 | int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk); |
| 210 | 211 | bool vsock_find_cid(unsigned int cid); |
| 211 | 212 | |
| @@ -97,7 +97,6 @@ struct nf_conn { · 96 unmodified lines | ||
| 97 | 97 | unsigned long status; |
| 98 | 98 | |
| 99 | 99 | u16 cpu; |
| 100 | − u16 local_origin:1; | |
| 101 | 100 | possible_net_t ct_net; |
| 102 | 101 | |
| 103 | 102 | #if IS_ENABLED(CONFIG_NF_NAT) |
| @@ -1436,6 +1436,7 @@ static int dsa_port_parse_of(struct dsa_port *dp, struct device_node *dn) · 1435 unmodified lines | ||
| 1436 | 1436 | const char *user_protocol; |
| 1437 | 1437 | |
| 1438 | 1438 | master = of_find_net_device_by_node(ethernet); |
| 1439 | + of_node_put(ethernet); | |
| 1439 | 1440 | if (!master) |
| 1440 | 1441 | return -EPROBE_DEFER; |
| 1441 | 1442 | |
| @@ -812,8 +812,7 @@ int esp6_input_done2(struct sk_buff *skb, int err) · 811 unmodified lines | ||
| 812 | 812 | struct tcphdr *th; |
| 813 | 813 | |
| 814 | 814 | offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off); |
| 815 | − | |
| 816 | − if (offset < 0) { | |
| 815 | + if (offset == -1) { | |
| 817 | 816 | err = -EINVAL; |
| 818 | 817 | goto out; |
| 819 | 818 | } |
| @@ -1476,8 +1476,8 @@ static int __ip6_append_data(struct sock *sk, · 1475 unmodified lines | ||
| 1476 | 1476 | sizeof(struct frag_hdr) : 0) + |
| 1477 | 1477 | rt->rt6i_nfheader_len; |
| 1478 | 1478 | |
| 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)) | |
| 1481 | 1481 | goto emsgsize; |
| 1482 | 1482 | |
| 1483 | 1483 | maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - |
| @@ -1699,7 +1699,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad · 1698 unmodified lines | ||
| 1699 | 1699 | |
| 1700 | 1700 | xfrm_probe_algs(); |
| 1701 | 1701 | |
| 1702 | − supp_skb = compose_sadb_supported(hdr, GFP_KERNEL); | |
| 1702 | + supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO); | |
| 1703 | 1703 | if (!supp_skb) { |
| 1704 | 1704 | if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) |
| 1705 | 1705 | pfk->registered &= ~(1<<hdr->sadb_msg_satype); |
| @@ -1748,9 +1748,6 @@ resolve_normal_ct(struct nf_conn *tmpl, · 1747 unmodified lines | ||
| 1748 | 1748 | return 0; |
| 1749 | 1749 | if (IS_ERR(h)) |
| 1750 | 1750 | return PTR_ERR(h); |
| 1751 | − | |
| 1752 | − ct = nf_ct_tuplehash_to_ctrack(h); | |
| 1753 | − ct->local_origin = state->hook == NF_INET_LOCAL_OUT; | |
| 1754 | 1751 | } |
| 1755 | 1752 | ct = nf_ct_tuplehash_to_ctrack(h); |
| 1756 | 1753 | |
| @@ -494,38 +494,6 @@ another_round: · 493 unmodified lines | ||
| 494 | 494 | goto another_round; |
| 495 | 495 | } |
| 496 | 496 | |
| 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 | − | |
| 529 | 497 | /* Manipulate the tuple into the range given. For NF_INET_POST_ROUTING, |
| 530 | 498 | * we change the source to map into the range. For NF_INET_PRE_ROUTING |
| 531 | 499 | * 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 | ||
| 539 | 507 | struct nf_conn *ct, |
| 540 | 508 | enum nf_nat_manip_type maniptype) |
| 541 | 509 | { |
| 542 | − bool random_port = range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL; | |
| 543 | 510 | const struct nf_conntrack_zone *zone; |
| 544 | 511 | struct net *net = nf_ct_net(ct); |
| 545 | 512 | |
| 546 | 513 | zone = nf_ct_zone(ct); |
| 547 | 514 | |
| 548 | − if (maniptype == NF_NAT_MANIP_SRC && | |
| 549 | − !random_port && | |
| 550 | − !ct->local_origin) | |
| 551 | − random_port = tuple_force_port_remap(orig_tuple); | |
| 552 | − | |
| 553 | 515 | /* 1) If this srcip/proto/src-proto-part is currently mapped, |
| 554 | 516 | * and that same mapping gives a unique tuple within the given |
| 555 | 517 | * range, use that. |
| @@ -558,7 +520,8 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple, · 2 unmodified lines | ||
| 558 | 520 | * So far, we don't do local source mappings, so multiple |
| 559 | 521 | * manips not an issue. |
| 560 | 522 | */ |
| 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)) { | |
| 562 | 525 | /* try the original tuple first */ |
| 563 | 526 | if (in_range(orig_tuple, range)) { |
| 564 | 527 | if (!nf_nat_used_tuple(orig_tuple, ct)) { |
| @@ -582,7 +545,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple, · 17 unmodified lines | ||
| 582 | 545 | */ |
| 583 | 546 | |
| 584 | 547 | /* 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)) { | |
| 586 | 549 | if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) { |
| 587 | 550 | if (!(range->flags & NF_NAT_RANGE_PROTO_OFFSET) && |
| 588 | 551 | l4proto_in_range(tuple, maniptype, |
| @@ -8260,6 +8260,12 @@ void nf_tables_trans_destroy_flush_work(void) · 8259 unmodified lines | ||
| 8260 | 8260 | } |
| 8261 | 8261 | EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work); |
| 8262 | 8262 | |
| 8263 | +static bool nft_expr_reduce(struct nft_regs_track *track, | |
| 8264 | + const struct nft_expr *expr) | |
| 8265 | +{ | |
| 8266 | + return false; | |
| 8267 | +} | |
| 8268 | + | |
| 8263 | 8269 | static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *chain) |
| 8264 | 8270 | { |
| 8265 | 8271 | 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 | ||
| 8307 | 8313 | nft_rule_for_each_expr(expr, last, rule) { |
| 8308 | 8314 | track.cur = expr; |
| 8309 | 8315 | |
| 8310 | − if (expr->ops->reduce && | |
| 8311 | − expr->ops->reduce(&track, expr)) { | |
| 8316 | + if (nft_expr_reduce(&track, expr)) { | |
| 8312 | 8317 | expr = track.cur; |
| 8313 | 8318 | continue; |
| 8314 | 8319 | } |
| @@ -2317,8 +2317,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 2316 unmodified lines | ||
| 2317 | 2317 | copy_skb = skb_get(skb); |
| 2318 | 2318 | skb_head = skb->data; |
| 2319 | 2319 | } |
| 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)); | |
| 2321 | 2323 | skb_set_owner_r(copy_skb, sk); |
| 2324 | + } | |
| 2322 | 2325 | } |
| 2323 | 2326 | snaplen = po->rx_ring.frame_size - macoff; |
| 2324 | 2327 | if ((int)snaplen < 0) { |
| @@ -3462,6 +3465,8 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 1137 unmodified lines | ||
| 3462 | 3465 | sock_recv_ts_and_drops(msg, sk, skb); |
| 3463 | 3466 | |
| 3464 | 3467 | if (msg->msg_name) { |
| 3468 | + const size_t max_len = min(sizeof(skb->cb), | |
| 3469 | + sizeof(struct sockaddr_storage)); | |
| 3465 | 3470 | int copy_len; |
| 3466 | 3471 | |
| 3467 | 3472 | /* 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 | ||
| 3484 | 3489 | msg->msg_namelen = sizeof(struct sockaddr_ll); |
| 3485 | 3490 | } |
| 3486 | 3491 | } |
| 3492 | + if (WARN_ON_ONCE(copy_len > max_len)) { | |
| 3493 | + copy_len = max_len; | |
| 3494 | + msg->msg_namelen = copy_len; | |
| 3495 | + } | |
| 3487 | 3496 | memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len); |
| 3488 | 3497 | } |
| 3489 | 3498 | |
| @@ -334,7 +334,8 @@ void vsock_remove_sock(struct vsock_sock *vsk) · 333 unmodified lines | ||
| 334 | 334 | } |
| 335 | 335 | EXPORT_SYMBOL_GPL(vsock_remove_sock); |
| 336 | 336 | |
| 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)) | |
| 338 | 339 | { |
| 339 | 340 | int i; |
| 340 | 341 | |
| @@ -343,8 +344,12 @@ void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) · 2 unmodified lines | ||
| 343 | 344 | for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { |
| 344 | 345 | struct vsock_sock *vsk; |
| 345 | 346 | list_for_each_entry(vsk, &vsock_connected_table[i], |
| 346 | − connected_table) | |
| 347 | + connected_table) { | |
| 348 | + if (vsk->transport != transport) | |
| 349 | + continue; | |
| 350 | + | |
| 347 | 351 | fn(sk_vsock(vsk)); |
| 352 | + } | |
| 348 | 353 | } |
| 349 | 354 | |
| 350 | 355 | spin_unlock_bh(&vsock_table_lock); |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | static struct workqueue_struct *virtio_vsock_workqueue; |
| 25 | 25 | static struct virtio_vsock __rcu *the_virtio_vsock; |
| 26 | 26 | static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */ |
| 27 | +static struct virtio_transport virtio_transport; /* forward declaration */ | |
| 27 | 28 | |
| 28 | 29 | struct virtio_vsock { |
| 29 | 30 | struct virtio_device *vdev; |
| @@ -384,7 +385,8 @@ static void virtio_vsock_event_handle(struct virtio_vsock *vsock, · 354 unmodified lines | ||
| 384 | 385 | switch (le32_to_cpu(event->id)) { |
| 385 | 386 | case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET: |
| 386 | 387 | 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); | |
| 388 | 390 | break; |
| 389 | 391 | } |
| 390 | 392 | } |
| @@ -662,7 +664,8 @@ static void virtio_vsock_remove(struct virtio_device *vdev) · 271 unmodified lines | ||
| 662 | 664 | synchronize_rcu(); |
| 663 | 665 | |
| 664 | 666 | /* 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); | |
| 666 | 669 | |
| 667 | 670 | /* Stop all work handlers to make sure no one is accessing the device, |
| 668 | 671 | * so we can safely call virtio_reset_device(). |
| @@ -75,6 +75,8 @@ static u32 vmci_transport_qp_resumed_sub_id = VMCI_INVALID_ID; · 74 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | static int PROTOCOL_OVERRIDE = -1; |
| 77 | 77 | |
| 78 | +static struct vsock_transport vmci_transport; /* forward declaration */ | |
| 79 | + | |
| 78 | 80 | /* Helper function to convert from a VMCI error code to a VSock error code. */ |
| 79 | 81 | |
| 80 | 82 | 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 | ||
| 882 | 884 | const struct vmci_event_data *e_data, |
| 883 | 885 | void *client_data) |
| 884 | 886 | { |
| 885 | − vsock_for_each_connected_socket(vmci_transport_handle_detach); | |
| 887 | + vsock_for_each_connected_socket(&vmci_transport, | |
| 888 | + vmci_transport_handle_detach); | |
| 886 | 889 | } |
| 887 | 890 | |
| 888 | 891 | static void vmci_transport_recv_pkt_work(struct work_struct *work) |
| @@ -880,9 +880,8 @@ EOF · 879 unmodified lines | ||
| 880 | 880 | return $ksft_skip |
| 881 | 881 | fi |
| 882 | 882 | |
| 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" | |
| 886 | 885 | |
| 887 | 886 | # test packet filter based mitigation: prevent forwarding of |
| 888 | 887 | # packets claiming to come from the service port. |