Networking fixes for 5.17-final, including fixes from netfilter, ipsec,

and wireless.
 
 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!
 
 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE6jPA+I1ugmIBA4hXMUZtbf5SIrsFAmIzZb4ACgkQMUZtbf5S
 IruPURAAs4A7xW5FdqjEFrvUzLZVIhxyWH10Q3KXN65lSO0PitIyO455y/3OoIWA
 P6djVeH7bDY7wH/y3Uqctz35wuJaeH44kIHwk3QufStaPeDSC6Z+/O9QU82jIZ+T
 X8AqoBgf7j/NTpiAcVfS2Bsr+ZJVGC1IgqOy4n+bZZdg+BWElZlxQMhUfwqaptAp
 rM3wwvzqvWyiVDGbxsQf2OJll3ivFqJuahcs6PaPffIi7xno+uyeEnt7aX/vLHQF
 qzq59I4glcJ90KTFeUP7PW7pmk6uIEyhXGnHbZpstgpTDL0lHnpszdw3jLg/bgfT
 Dgvf2JjnLGMUU7ER+y89USG9s0h8MWQSLcalL1WHcwkq5QjEPMFyz+LQZvDBsZO6
 G/8V1e+wDsPJ+q0jmbTzvPECm+xeb4Wnh+Qgx0WXcDEU4aAavTutJJmFRklPVhEl
 dSuZXtYgkiz/VOE+WzR8AMYNNZ/pbmsUhQw2QuOfL+hWKd/f/kRwD0iErwrk0cEX
 aDHvuyt10lTeh2ALM1hE2QVNu3jf8OyiZnFaP8gRoridDFRPyQVlWSOYW+6nLzUb
 7PP0pfn2dECGgscn7SWkEpRf75ZRSUq/obCziwjMrczb9iUDqFOm9Uy9Lf6ZHFyy
 XcA9mnxUUGUVQtC7ynTtZvu+/A7C/PfMe9H9HdzWwJ+rAEGpdiA=
 =pStH
 -----END PGP SIGNATURE-----

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
  ...
This commit is contained in:
Linus Torvalds 2022-03-17 12:55:26 -07:00
commit 551acdc3c3
33 changed files with 154 additions and 133 deletions

View File

@ -13376,6 +13376,7 @@ F: net/core/drop_monitor.c
NETWORKING DRIVERS NETWORKING DRIVERS
M: "David S. Miller" <davem@davemloft.net> M: "David S. Miller" <davem@davemloft.net>
M: Jakub Kicinski <kuba@kernel.org> M: Jakub Kicinski <kuba@kernel.org>
M: Paolo Abeni <pabeni@redhat.com>
L: netdev@vger.kernel.org L: netdev@vger.kernel.org
S: Maintained S: Maintained
Q: https://patchwork.kernel.org/project/netdevbpf/list/ Q: https://patchwork.kernel.org/project/netdevbpf/list/
@ -13422,6 +13423,7 @@ F: tools/testing/selftests/drivers/net/dsa/
NETWORKING [GENERAL] NETWORKING [GENERAL]
M: "David S. Miller" <davem@davemloft.net> M: "David S. Miller" <davem@davemloft.net>
M: Jakub Kicinski <kuba@kernel.org> M: Jakub Kicinski <kuba@kernel.org>
M: Paolo Abeni <pabeni@redhat.com>
L: netdev@vger.kernel.org L: netdev@vger.kernel.org
S: Maintained S: Maintained
Q: https://patchwork.kernel.org/project/netdevbpf/list/ Q: https://patchwork.kernel.org/project/netdevbpf/list/

View File

@ -1112,6 +1112,8 @@ DPRINTK("iovcnt = %d\n",skb_shinfo(skb)->nr_frags);
skb_data3 = skb->data[3]; skb_data3 = skb->data[3];
paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len, paddr = dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr))
return enq_next;
ENI_PRV_PADDR(skb) = paddr; ENI_PRV_PADDR(skb) = paddr;
/* prepare DMA queue entries */ /* prepare DMA queue entries */
j = 0; j = 0;

View File

@ -124,12 +124,23 @@ static const struct of_device_id ksz8795_dt_ids[] = {
}; };
MODULE_DEVICE_TABLE(of, ksz8795_dt_ids); MODULE_DEVICE_TABLE(of, ksz8795_dt_ids);
static const struct spi_device_id ksz8795_spi_ids[] = {
{ "ksz8765" },
{ "ksz8794" },
{ "ksz8795" },
{ "ksz8863" },
{ "ksz8873" },
{ },
};
MODULE_DEVICE_TABLE(spi, ksz8795_spi_ids);
static struct spi_driver ksz8795_spi_driver = { static struct spi_driver ksz8795_spi_driver = {
.driver = { .driver = {
.name = "ksz8795-switch", .name = "ksz8795-switch",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(ksz8795_dt_ids), .of_match_table = of_match_ptr(ksz8795_dt_ids),
}, },
.id_table = ksz8795_spi_ids,
.probe = ksz8795_spi_probe, .probe = ksz8795_spi_probe,
.remove = ksz8795_spi_remove, .remove = ksz8795_spi_remove,
.shutdown = ksz8795_spi_shutdown, .shutdown = ksz8795_spi_shutdown,

View File

@ -98,12 +98,24 @@ static const struct of_device_id ksz9477_dt_ids[] = {
}; };
MODULE_DEVICE_TABLE(of, ksz9477_dt_ids); MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
static const struct spi_device_id ksz9477_spi_ids[] = {
{ "ksz9477" },
{ "ksz9897" },
{ "ksz9893" },
{ "ksz9563" },
{ "ksz8563" },
{ "ksz9567" },
{ },
};
MODULE_DEVICE_TABLE(spi, ksz9477_spi_ids);
static struct spi_driver ksz9477_spi_driver = { static struct spi_driver ksz9477_spi_driver = {
.driver = { .driver = {
.name = "ksz9477-switch", .name = "ksz9477-switch",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(ksz9477_dt_ids), .of_match_table = of_match_ptr(ksz9477_dt_ids),
}, },
.id_table = ksz9477_spi_ids,
.probe = ksz9477_spi_probe, .probe = ksz9477_spi_probe,
.remove = ksz9477_spi_remove, .remove = ksz9477_spi_remove,
.shutdown = ksz9477_spi_shutdown, .shutdown = ksz9477_spi_shutdown,

View File

@ -1181,8 +1181,11 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
alx->hw.mtu = mtu; alx->hw.mtu = mtu;
alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);
netdev_update_features(netdev); netdev_update_features(netdev);
if (netif_running(netdev)) if (netif_running(netdev)) {
mutex_lock(&alx->mtx);
alx_reinit(alx); alx_reinit(alx);
mutex_unlock(&alx->mtx);
}
return 0; return 0;
} }

View File

@ -2533,6 +2533,4 @@ void bnx2x_register_phc(struct bnx2x *bp);
* Meant for implicit re-load flows. * Meant for implicit re-load flows.
*/ */
int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp); int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp);
int bnx2x_init_firmware(struct bnx2x *bp);
void bnx2x_release_firmware(struct bnx2x *bp);
#endif /* bnx2x.h */ #endif /* bnx2x.h */

View File

@ -2364,24 +2364,30 @@ int bnx2x_compare_fw_ver(struct bnx2x *bp, u32 load_code, bool print_err)
/* is another pf loaded on this engine? */ /* is another pf loaded on this engine? */
if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP &&
load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { load_code != FW_MSG_CODE_DRV_LOAD_COMMON) {
/* build my FW version dword */ u8 loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng;
u32 my_fw = (bp->fw_major) + (bp->fw_minor << 8) + u32 loaded_fw;
(bp->fw_rev << 16) + (bp->fw_eng << 24);
/* read loaded FW from chip */ /* read loaded FW from chip */
u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); loaded_fw = REG_RD(bp, XSEM_REG_PRAM);
DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x\n", loaded_fw_major = loaded_fw & 0xff;
loaded_fw, my_fw); loaded_fw_minor = (loaded_fw >> 8) & 0xff;
loaded_fw_rev = (loaded_fw >> 16) & 0xff;
loaded_fw_eng = (loaded_fw >> 24) & 0xff;
DP(BNX2X_MSG_SP, "loaded fw 0x%x major 0x%x minor 0x%x rev 0x%x eng 0x%x\n",
loaded_fw, loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng);
/* abort nic load if version mismatch */ /* abort nic load if version mismatch */
if (my_fw != loaded_fw) { if (loaded_fw_major != BCM_5710_FW_MAJOR_VERSION ||
loaded_fw_minor != BCM_5710_FW_MINOR_VERSION ||
loaded_fw_eng != BCM_5710_FW_ENGINEERING_VERSION ||
loaded_fw_rev < BCM_5710_FW_REVISION_VERSION_V15) {
if (print_err) if (print_err)
BNX2X_ERR("bnx2x with FW %x was already loaded which mismatches my %x FW. Aborting\n", BNX2X_ERR("loaded FW incompatible. Aborting\n");
loaded_fw, my_fw);
else else
BNX2X_DEV_INFO("bnx2x with FW %x was already loaded which mismatches my %x FW, possibly due to MF UNDI\n", BNX2X_DEV_INFO("loaded FW incompatible, possibly due to MF UNDI\n");
loaded_fw, my_fw);
return -EBUSY; return -EBUSY;
} }
} }

View File

@ -12319,15 +12319,6 @@ static int bnx2x_init_bp(struct bnx2x *bp)
bnx2x_read_fwinfo(bp); bnx2x_read_fwinfo(bp);
if (IS_PF(bp)) {
rc = bnx2x_init_firmware(bp);
if (rc) {
bnx2x_free_mem_bp(bp);
return rc;
}
}
func = BP_FUNC(bp); func = BP_FUNC(bp);
/* need to reset chip if undi was active */ /* need to reset chip if undi was active */
@ -12340,7 +12331,6 @@ static int bnx2x_init_bp(struct bnx2x *bp)
rc = bnx2x_prev_unload(bp); rc = bnx2x_prev_unload(bp);
if (rc) { if (rc) {
bnx2x_release_firmware(bp);
bnx2x_free_mem_bp(bp); bnx2x_free_mem_bp(bp);
return rc; return rc;
} }
@ -13409,7 +13399,7 @@ do { \
(u8 *)bp->arr, len); \ (u8 *)bp->arr, len); \
} while (0) } while (0)
int bnx2x_init_firmware(struct bnx2x *bp) static int bnx2x_init_firmware(struct bnx2x *bp)
{ {
const char *fw_file_name, *fw_file_name_v15; const char *fw_file_name, *fw_file_name_v15;
struct bnx2x_fw_file_hdr *fw_hdr; struct bnx2x_fw_file_hdr *fw_hdr;
@ -13509,7 +13499,7 @@ request_firmware_exit:
return rc; return rc;
} }
void bnx2x_release_firmware(struct bnx2x *bp) static void bnx2x_release_firmware(struct bnx2x *bp)
{ {
kfree(bp->init_ops_offsets); kfree(bp->init_ops_offsets);
kfree(bp->init_ops); kfree(bp->init_ops);
@ -14026,7 +14016,6 @@ static int bnx2x_init_one(struct pci_dev *pdev,
return 0; return 0;
init_one_freemem: init_one_freemem:
bnx2x_release_firmware(bp);
bnx2x_free_mem_bp(bp); bnx2x_free_mem_bp(bp);
init_one_exit: init_one_exit:

View File

@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
dma_length_status = status->length_status; dma_length_status = status->length_status;
if (dev->features & NETIF_F_RXCSUM) { if (dev->features & NETIF_F_RXCSUM) {
rx_csum = (__force __be16)(status->rx_csum & 0xffff); rx_csum = (__force __be16)(status->rx_csum & 0xffff);
skb->csum = (__force __wsum)ntohs(rx_csum); if (rx_csum) {
skb->ip_summed = CHECKSUM_COMPLETE; skb->csum = (__force __wsum)ntohs(rx_csum);
skb->ip_summed = CHECKSUM_COMPLETE;
}
} }
/* DMA flags and length are still valid no matter how /* DMA flags and length are still valid no matter how

View File

@ -2541,6 +2541,13 @@ restart_watchdog:
queue_delayed_work(iavf_wq, &adapter->watchdog_task, HZ * 2); queue_delayed_work(iavf_wq, &adapter->watchdog_task, HZ * 2);
} }
/**
* iavf_disable_vf - disable VF
* @adapter: board private structure
*
* Set communication failed flag and free all resources.
* NOTE: This function is expected to be called with crit_lock being held.
**/
static void iavf_disable_vf(struct iavf_adapter *adapter) static void iavf_disable_vf(struct iavf_adapter *adapter)
{ {
struct iavf_mac_filter *f, *ftmp; struct iavf_mac_filter *f, *ftmp;
@ -2595,7 +2602,6 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE); memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
iavf_shutdown_adminq(&adapter->hw); iavf_shutdown_adminq(&adapter->hw);
adapter->netdev->flags &= ~IFF_UP; adapter->netdev->flags &= ~IFF_UP;
mutex_unlock(&adapter->crit_lock);
adapter->flags &= ~IAVF_FLAG_RESET_PENDING; adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
iavf_change_state(adapter, __IAVF_DOWN); iavf_change_state(adapter, __IAVF_DOWN);
wake_up(&adapter->down_waitqueue); wake_up(&adapter->down_waitqueue);
@ -4614,6 +4620,13 @@ static void iavf_remove(struct pci_dev *pdev)
struct iavf_hw *hw = &adapter->hw; struct iavf_hw *hw = &adapter->hw;
int err; int err;
/* When reboot/shutdown is in progress no need to do anything
* as the adapter is already REMOVE state that was set during
* iavf_shutdown() callback.
*/
if (adapter->state == __IAVF_REMOVE)
return;
set_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section); set_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section);
/* Wait until port initialization is complete. /* Wait until port initialization is complete.
* There are flows where register/unregister netdev may race. * There are flows where register/unregister netdev may race.

View File

@ -4880,7 +4880,6 @@ static void ice_remove(struct pci_dev *pdev)
ice_devlink_unregister_params(pf); ice_devlink_unregister_params(pf);
set_bit(ICE_DOWN, pf->state); set_bit(ICE_DOWN, pf->state);
mutex_destroy(&(&pf->hw)->fdir_fltr_lock);
ice_deinit_lag(pf); ice_deinit_lag(pf);
if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags))
ice_ptp_release(pf); ice_ptp_release(pf);
@ -4888,6 +4887,7 @@ static void ice_remove(struct pci_dev *pdev)
ice_remove_arfs(pf); ice_remove_arfs(pf);
ice_setup_mc_magic_wake(pf); ice_setup_mc_magic_wake(pf);
ice_vsi_release_all(pf); ice_vsi_release_all(pf);
mutex_destroy(&(&pf->hw)->fdir_fltr_lock);
ice_set_wake(pf); ice_set_wake(pf);
ice_free_irq_msix_misc(pf); ice_free_irq_msix_misc(pf);
ice_for_each_vsi(pf, i) { ice_for_each_vsi(pf, i) {
@ -5962,8 +5962,9 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi,
u64 pkts = 0, bytes = 0; u64 pkts = 0, bytes = 0;
ring = READ_ONCE(rings[i]); ring = READ_ONCE(rings[i]);
if (ring) if (!ring)
ice_fetch_u64_stats_per_ring(&ring->syncp, ring->stats, &pkts, &bytes); continue;
ice_fetch_u64_stats_per_ring(&ring->syncp, ring->stats, &pkts, &bytes);
vsi_stats->tx_packets += pkts; vsi_stats->tx_packets += pkts;
vsi_stats->tx_bytes += bytes; vsi_stats->tx_bytes += bytes;
vsi->tx_restart += ring->tx_stats.restart_q; vsi->tx_restart += ring->tx_stats.restart_q;

View File

@ -60,6 +60,12 @@ static int ocelot_chain_to_block(int chain, bool ingress)
*/ */
static int ocelot_chain_to_lookup(int chain) static int ocelot_chain_to_lookup(int chain)
{ {
/* Backwards compatibility with older, single-chain tc-flower
* offload support in Ocelot
*/
if (chain == 0)
return 0;
return (chain / VCAP_LOOKUP) % 10; return (chain / VCAP_LOOKUP) % 10;
} }
@ -68,7 +74,15 @@ static int ocelot_chain_to_lookup(int chain)
*/ */
static int ocelot_chain_to_pag(int chain) static int ocelot_chain_to_pag(int chain)
{ {
int lookup = ocelot_chain_to_lookup(chain); int lookup;
/* Backwards compatibility with older, single-chain tc-flower
* offload support in Ocelot
*/
if (chain == 0)
return 0;
lookup = ocelot_chain_to_lookup(chain);
/* calculate PAG value as chain index relative to the first PAG */ /* calculate PAG value as chain index relative to the first PAG */
return chain - VCAP_IS2_CHAIN(lookup, 0); return chain - VCAP_IS2_CHAIN(lookup, 0);

View File

@ -1587,6 +1587,9 @@ static void netvsc_get_ethtool_stats(struct net_device *dev,
pcpu_sum = kvmalloc_array(num_possible_cpus(), pcpu_sum = kvmalloc_array(num_possible_cpus(),
sizeof(struct netvsc_ethtool_pcpu_stats), sizeof(struct netvsc_ethtool_pcpu_stats),
GFP_KERNEL); GFP_KERNEL);
if (!pcpu_sum)
return;
netvsc_get_pcpu_stats(dev, pcpu_sum); netvsc_get_pcpu_stats(dev, pcpu_sum);
for_each_present_cpu(cpu) { for_each_present_cpu(cpu) {
struct netvsc_ethtool_pcpu_stats *this_sum = &pcpu_sum[cpu]; struct netvsc_ethtool_pcpu_stats *this_sum = &pcpu_sum[cpu];

View File

@ -187,6 +187,13 @@ static const struct regmap_config mscc_miim_regmap_config = {
.reg_stride = 4, .reg_stride = 4,
}; };
static const struct regmap_config mscc_miim_phy_regmap_config = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
.name = "phy",
};
int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name, int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
struct regmap *mii_regmap, int status_offset) struct regmap *mii_regmap, int status_offset)
{ {
@ -250,7 +257,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
} }
phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs, phy_regmap = devm_regmap_init_mmio(&pdev->dev, phy_regs,
&mscc_miim_regmap_config); &mscc_miim_phy_regmap_config);
if (IS_ERR(phy_regmap)) { if (IS_ERR(phy_regmap)) {
dev_err(&pdev->dev, "Unable to create phy register regmap\n"); dev_err(&pdev->dev, "Unable to create phy register regmap\n");
return PTR_ERR(phy_regmap); return PTR_ERR(phy_regmap);

View File

@ -1687,8 +1687,8 @@ static int marvell_suspend(struct phy_device *phydev)
int err; int err;
/* Suspend the fiber mode first */ /* Suspend the fiber mode first */
if (!linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
phydev->supported)) { phydev->supported)) {
err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE);
if (err < 0) if (err < 0)
goto error; goto error;
@ -1722,8 +1722,8 @@ static int marvell_resume(struct phy_device *phydev)
int err; int err;
/* Resume the fiber mode first */ /* Resume the fiber mode first */
if (!linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
phydev->supported)) { phydev->supported)) {
err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); err = marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE);
if (err < 0) if (err < 0)
goto error; goto error;

View File

@ -2685,3 +2685,6 @@ MODULE_DEVICE_TABLE(mdio, vsc85xx_tbl);
MODULE_DESCRIPTION("Microsemi VSC85xx PHY driver"); MODULE_DESCRIPTION("Microsemi VSC85xx PHY driver");
MODULE_AUTHOR("Nagaraju Lakkaraju"); MODULE_AUTHOR("Nagaraju Lakkaraju");
MODULE_LICENSE("Dual MIT/GPL"); MODULE_LICENSE("Dual MIT/GPL");
MODULE_FIRMWARE(MSCC_VSC8584_REVB_INT8051_FW);
MODULE_FIRMWARE(MSCC_VSC8574_REVB_INT8051_FW);

View File

@ -2611,36 +2611,9 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
ath10k_mac_handle_beacon(ar, skb); ath10k_mac_handle_beacon(ar, skb);
if (ieee80211_is_beacon(hdr->frame_control) || if (ieee80211_is_beacon(hdr->frame_control) ||
ieee80211_is_probe_resp(hdr->frame_control)) { ieee80211_is_probe_resp(hdr->frame_control))
struct ieee80211_mgmt *mgmt = (void *)skb->data;
enum cfg80211_bss_frame_type ftype;
u8 *ies;
int ies_ch;
status->boottime_ns = ktime_get_boottime_ns(); status->boottime_ns = ktime_get_boottime_ns();
if (!ar->scan_channel)
goto drop;
ies = mgmt->u.beacon.variable;
if (ieee80211_is_beacon(mgmt->frame_control))
ftype = CFG80211_BSS_FTYPE_BEACON;
else
ftype = CFG80211_BSS_FTYPE_PRESP;
ies_ch = cfg80211_get_ies_channel_number(mgmt->u.beacon.variable,
skb_tail_pointer(skb) - ies,
sband->band, ftype);
if (ies_ch > 0 && ies_ch != channel) {
ath10k_dbg(ar, ATH10K_DBG_MGMT,
"channel mismatched ds channel %d scan channel %d\n",
ies_ch, channel);
goto drop;
}
}
ath10k_dbg(ar, ATH10K_DBG_MGMT, ath10k_dbg(ar, ATH10K_DBG_MGMT,
"event mgmt rx skb %pK len %d ftype %02x stype %02x\n", "event mgmt rx skb %pK len %d ftype %02x stype %02x\n",
skb, skb->len, skb, skb->len,
@ -2654,10 +2627,6 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
ieee80211_rx_ni(ar->hw, skb); ieee80211_rx_ni(ar->hw, skb);
return 0; return 0;
drop:
dev_kfree_skb(skb);
return 0;
} }
static int freq_to_idx(struct ath10k *ar, int freq) static int freq_to_idx(struct ath10k *ar, int freq)

View File

@ -753,7 +753,8 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file)
/* Iterating over all connections for all CIDs to find orphans is /* Iterating over all connections for all CIDs to find orphans is
* inefficient. Room for improvement here. */ * inefficient. Room for improvement here. */
vsock_for_each_connected_socket(vhost_vsock_reset_orphans); vsock_for_each_connected_socket(&vhost_transport.transport,
vhost_vsock_reset_orphans);
/* Don't check the owner, because we are in the release path, so we /* Don't check the owner, because we are in the release path, so we
* need to stop the vsock device in any case. * need to stop the vsock device in any case.

View File

@ -52,6 +52,7 @@ static inline bool dev_is_mac_header_xmit(const struct net_device *dev)
case ARPHRD_VOID: case ARPHRD_VOID:
case ARPHRD_NONE: case ARPHRD_NONE:
case ARPHRD_RAWIP: case ARPHRD_RAWIP:
case ARPHRD_PIMREG:
return false; return false;
default: default:
return true; return true;

View File

@ -205,7 +205,8 @@ struct sock *vsock_find_bound_socket(struct sockaddr_vm *addr);
struct sock *vsock_find_connected_socket(struct sockaddr_vm *src, struct sock *vsock_find_connected_socket(struct sockaddr_vm *src,
struct sockaddr_vm *dst); struct sockaddr_vm *dst);
void vsock_remove_sock(struct vsock_sock *vsk); void vsock_remove_sock(struct vsock_sock *vsk);
void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)); void vsock_for_each_connected_socket(struct vsock_transport *transport,
void (*fn)(struct sock *sk));
int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk); int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk);
bool vsock_find_cid(unsigned int cid); bool vsock_find_cid(unsigned int cid);

View File

@ -97,7 +97,6 @@ struct nf_conn {
unsigned long status; unsigned long status;
u16 cpu; u16 cpu;
u16 local_origin:1;
possible_net_t ct_net; possible_net_t ct_net;
#if IS_ENABLED(CONFIG_NF_NAT) #if IS_ENABLED(CONFIG_NF_NAT)

View File

@ -1436,6 +1436,7 @@ static int dsa_port_parse_of(struct dsa_port *dp, struct device_node *dn)
const char *user_protocol; const char *user_protocol;
master = of_find_net_device_by_node(ethernet); master = of_find_net_device_by_node(ethernet);
of_node_put(ethernet);
if (!master) if (!master)
return -EPROBE_DEFER; return -EPROBE_DEFER;

View File

@ -812,8 +812,7 @@ int esp6_input_done2(struct sk_buff *skb, int err)
struct tcphdr *th; struct tcphdr *th;
offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off); offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off);
if (offset == -1) {
if (offset < 0) {
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }

View File

@ -1476,8 +1476,8 @@ static int __ip6_append_data(struct sock *sk,
sizeof(struct frag_hdr) : 0) + sizeof(struct frag_hdr) : 0) +
rt->rt6i_nfheader_len; rt->rt6i_nfheader_len;
if (mtu < fragheaderlen || if (mtu <= fragheaderlen ||
((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr)) ((mtu - fragheaderlen) & ~7) + fragheaderlen <= sizeof(struct frag_hdr))
goto emsgsize; goto emsgsize;
maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen -

View File

@ -1699,7 +1699,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad
xfrm_probe_algs(); xfrm_probe_algs();
supp_skb = compose_sadb_supported(hdr, GFP_KERNEL); supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO);
if (!supp_skb) { if (!supp_skb) {
if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC)
pfk->registered &= ~(1<<hdr->sadb_msg_satype); pfk->registered &= ~(1<<hdr->sadb_msg_satype);

View File

@ -1748,9 +1748,6 @@ resolve_normal_ct(struct nf_conn *tmpl,
return 0; return 0;
if (IS_ERR(h)) if (IS_ERR(h))
return PTR_ERR(h); return PTR_ERR(h);
ct = nf_ct_tuplehash_to_ctrack(h);
ct->local_origin = state->hook == NF_INET_LOCAL_OUT;
} }
ct = nf_ct_tuplehash_to_ctrack(h); ct = nf_ct_tuplehash_to_ctrack(h);

View File

@ -494,38 +494,6 @@ another_round:
goto another_round; goto another_round;
} }
static bool tuple_force_port_remap(const struct nf_conntrack_tuple *tuple)
{
u16 sp, dp;
switch (tuple->dst.protonum) {
case IPPROTO_TCP:
sp = ntohs(tuple->src.u.tcp.port);
dp = ntohs(tuple->dst.u.tcp.port);
break;
case IPPROTO_UDP:
case IPPROTO_UDPLITE:
sp = ntohs(tuple->src.u.udp.port);
dp = ntohs(tuple->dst.u.udp.port);
break;
default:
return false;
}
/* IANA: System port range: 1-1023,
* user port range: 1024-49151,
* private port range: 49152-65535.
*
* Linux default ephemeral port range is 32768-60999.
*
* Enforce port remapping if sport is significantly lower
* than dport to prevent NAT port shadowing, i.e.
* accidental match of 'new' inbound connection vs.
* existing outbound one.
*/
return sp < 16384 && dp >= 32768;
}
/* Manipulate the tuple into the range given. For NF_INET_POST_ROUTING, /* Manipulate the tuple into the range given. For NF_INET_POST_ROUTING,
* we change the source to map into the range. For NF_INET_PRE_ROUTING * we change the source to map into the range. For NF_INET_PRE_ROUTING
* and NF_INET_LOCAL_OUT, we change the destination to map into the * 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,
struct nf_conn *ct, struct nf_conn *ct,
enum nf_nat_manip_type maniptype) enum nf_nat_manip_type maniptype)
{ {
bool random_port = range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL;
const struct nf_conntrack_zone *zone; const struct nf_conntrack_zone *zone;
struct net *net = nf_ct_net(ct); struct net *net = nf_ct_net(ct);
zone = nf_ct_zone(ct); zone = nf_ct_zone(ct);
if (maniptype == NF_NAT_MANIP_SRC &&
!random_port &&
!ct->local_origin)
random_port = tuple_force_port_remap(orig_tuple);
/* 1) If this srcip/proto/src-proto-part is currently mapped, /* 1) If this srcip/proto/src-proto-part is currently mapped,
* and that same mapping gives a unique tuple within the given * and that same mapping gives a unique tuple within the given
* range, use that. * range, use that.
@ -558,7 +520,8 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple,
* So far, we don't do local source mappings, so multiple * So far, we don't do local source mappings, so multiple
* manips not an issue. * manips not an issue.
*/ */
if (maniptype == NF_NAT_MANIP_SRC && !random_port) { if (maniptype == NF_NAT_MANIP_SRC &&
!(range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL)) {
/* try the original tuple first */ /* try the original tuple first */
if (in_range(orig_tuple, range)) { if (in_range(orig_tuple, range)) {
if (!nf_nat_used_tuple(orig_tuple, ct)) { if (!nf_nat_used_tuple(orig_tuple, ct)) {
@ -582,7 +545,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple,
*/ */
/* Only bother mapping if it's not already in range and unique */ /* Only bother mapping if it's not already in range and unique */
if (!random_port) { if (!(range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL)) {
if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) { if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
if (!(range->flags & NF_NAT_RANGE_PROTO_OFFSET) && if (!(range->flags & NF_NAT_RANGE_PROTO_OFFSET) &&
l4proto_in_range(tuple, maniptype, l4proto_in_range(tuple, maniptype,

View File

@ -8260,6 +8260,12 @@ void nf_tables_trans_destroy_flush_work(void)
} }
EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work); EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work);
static bool nft_expr_reduce(struct nft_regs_track *track,
const struct nft_expr *expr)
{
return false;
}
static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *chain) static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *chain)
{ {
const struct nft_expr *expr, *last; const struct nft_expr *expr, *last;
@ -8307,8 +8313,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha
nft_rule_for_each_expr(expr, last, rule) { nft_rule_for_each_expr(expr, last, rule) {
track.cur = expr; track.cur = expr;
if (expr->ops->reduce && if (nft_expr_reduce(&track, expr)) {
expr->ops->reduce(&track, expr)) {
expr = track.cur; expr = track.cur;
continue; continue;
} }

View File

@ -2317,8 +2317,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
copy_skb = skb_get(skb); copy_skb = skb_get(skb);
skb_head = skb->data; skb_head = skb->data;
} }
if (copy_skb) if (copy_skb) {
memset(&PACKET_SKB_CB(copy_skb)->sa.ll, 0,
sizeof(PACKET_SKB_CB(copy_skb)->sa.ll));
skb_set_owner_r(copy_skb, sk); skb_set_owner_r(copy_skb, sk);
}
} }
snaplen = po->rx_ring.frame_size - macoff; snaplen = po->rx_ring.frame_size - macoff;
if ((int)snaplen < 0) { if ((int)snaplen < 0) {
@ -3462,6 +3465,8 @@ static int packet_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
sock_recv_ts_and_drops(msg, sk, skb); sock_recv_ts_and_drops(msg, sk, skb);
if (msg->msg_name) { if (msg->msg_name) {
const size_t max_len = min(sizeof(skb->cb),
sizeof(struct sockaddr_storage));
int copy_len; int copy_len;
/* If the address length field is there to be filled /* 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,
msg->msg_namelen = sizeof(struct sockaddr_ll); msg->msg_namelen = sizeof(struct sockaddr_ll);
} }
} }
if (WARN_ON_ONCE(copy_len > max_len)) {
copy_len = max_len;
msg->msg_namelen = copy_len;
}
memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len); memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len);
} }

View File

@ -334,7 +334,8 @@ void vsock_remove_sock(struct vsock_sock *vsk)
} }
EXPORT_SYMBOL_GPL(vsock_remove_sock); EXPORT_SYMBOL_GPL(vsock_remove_sock);
void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) void vsock_for_each_connected_socket(struct vsock_transport *transport,
void (*fn)(struct sock *sk))
{ {
int i; int i;
@ -343,8 +344,12 @@ void vsock_for_each_connected_socket(void (*fn)(struct sock *sk))
for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) {
struct vsock_sock *vsk; struct vsock_sock *vsk;
list_for_each_entry(vsk, &vsock_connected_table[i], list_for_each_entry(vsk, &vsock_connected_table[i],
connected_table) connected_table) {
if (vsk->transport != transport)
continue;
fn(sk_vsock(vsk)); fn(sk_vsock(vsk));
}
} }
spin_unlock_bh(&vsock_table_lock); spin_unlock_bh(&vsock_table_lock);

View File

@ -24,6 +24,7 @@
static struct workqueue_struct *virtio_vsock_workqueue; static struct workqueue_struct *virtio_vsock_workqueue;
static struct virtio_vsock __rcu *the_virtio_vsock; static struct virtio_vsock __rcu *the_virtio_vsock;
static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */ static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock */
static struct virtio_transport virtio_transport; /* forward declaration */
struct virtio_vsock { struct virtio_vsock {
struct virtio_device *vdev; struct virtio_device *vdev;
@ -384,7 +385,8 @@ static void virtio_vsock_event_handle(struct virtio_vsock *vsock,
switch (le32_to_cpu(event->id)) { switch (le32_to_cpu(event->id)) {
case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET: case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET:
virtio_vsock_update_guest_cid(vsock); virtio_vsock_update_guest_cid(vsock);
vsock_for_each_connected_socket(virtio_vsock_reset_sock); vsock_for_each_connected_socket(&virtio_transport.transport,
virtio_vsock_reset_sock);
break; break;
} }
} }
@ -662,7 +664,8 @@ static void virtio_vsock_remove(struct virtio_device *vdev)
synchronize_rcu(); synchronize_rcu();
/* Reset all connected sockets when the device disappear */ /* Reset all connected sockets when the device disappear */
vsock_for_each_connected_socket(virtio_vsock_reset_sock); vsock_for_each_connected_socket(&virtio_transport.transport,
virtio_vsock_reset_sock);
/* Stop all work handlers to make sure no one is accessing the device, /* Stop all work handlers to make sure no one is accessing the device,
* so we can safely call virtio_reset_device(). * so we can safely call virtio_reset_device().

View File

@ -75,6 +75,8 @@ static u32 vmci_transport_qp_resumed_sub_id = VMCI_INVALID_ID;
static int PROTOCOL_OVERRIDE = -1; static int PROTOCOL_OVERRIDE = -1;
static struct vsock_transport vmci_transport; /* forward declaration */
/* Helper function to convert from a VMCI error code to a VSock error code. */ /* Helper function to convert from a VMCI error code to a VSock error code. */
static s32 vmci_transport_error_to_vsock_error(s32 vmci_error) 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,
const struct vmci_event_data *e_data, const struct vmci_event_data *e_data,
void *client_data) void *client_data)
{ {
vsock_for_each_connected_socket(vmci_transport_handle_detach); vsock_for_each_connected_socket(&vmci_transport,
vmci_transport_handle_detach);
} }
static void vmci_transport_recv_pkt_work(struct work_struct *work) static void vmci_transport_recv_pkt_work(struct work_struct *work)

View File

@ -880,9 +880,8 @@ EOF
return $ksft_skip return $ksft_skip
fi fi
# test default behaviour. Packet from ns1 to ns0 is not redirected # test default behaviour. Packet from ns1 to ns0 is redirected to ns2.
# due to automatic port translation. test_port_shadow "default" "CLIENT"
test_port_shadow "default" "ROUTER"
# test packet filter based mitigation: prevent forwarding of # test packet filter based mitigation: prevent forwarding of
# packets claiming to come from the service port. # packets claiming to come from the service port.