linux/drivers/net
Aleksandr Loktionov dac6c7b3d3 i40e: Fix macvlan leak by synchronizing access to mac_filter_hash
This patch addresses a macvlan leak issue in the i40e driver caused by
concurrent access to vsi->mac_filter_hash. The leak occurs when multiple
threads attempt to modify the mac_filter_hash simultaneously, leading to
inconsistent state and potential memory leaks.

To fix this, we now wrap the calls to i40e_del_mac_filter() and zeroing
vf->default_lan_addr.addr with spin_lock/unlock_bh(&vsi->mac_filter_hash_lock),
ensuring atomic operations and preventing concurrent access.

Additionally, we add lockdep_assert_held(&vsi->mac_filter_hash_lock) in
i40e_add_mac_filter() to help catch similar issues in the future.

Reproduction steps:
1. Spawn VFs and configure port vlan on them.
2. Trigger concurrent macvlan operations (e.g., adding and deleting
	portvlan and/or mac filters).
3. Observe the potential memory leak and inconsistent state in the
	mac_filter_hash.

This synchronization ensures the integrity of the mac_filter_hash and prevents
the described leak.

Fixes: fed0d9f132 ("i40e: Fix VF's MAC Address change on VM")
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
2024-10-08 14:39:21 -07:00
..
arcnet
bonding bonding: Fix unnecessary warnings and logs from bond_xdp_get_xmit_slave() 2024-09-24 15:19:50 +02:00
caif
can move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
dsa net: dsa: b53: fix jumbo frames on 10/100 ports 2024-10-08 10:42:27 +02:00
ethernet i40e: Fix macvlan leak by synchronizing access to mac_filter_hash 2024-10-08 14:39:21 -07:00
fddi
fjes minmax: make generic MIN() and MAX() macros available everywhere 2024-07-28 15:49:18 -07:00
hamradio TTY/Serial driver update for 6.12-rc1 2024-09-26 09:59:50 -07:00
hippi
hyperv net: netvsc: Update default VMBus channels 2024-08-28 17:18:32 -07:00
ieee802154 Including fixes from ieee802154, bluetooth and netfilter. 2024-10-03 09:44:00 -07:00
ipa net: ipa: make use of dev_err_cast_probe() 2024-08-29 11:41:05 -07:00
ipvlan netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
mctp move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
mdio net: mdiobus: Debug print fwnode handle instead of raw pointer 2024-09-10 12:24:17 +02:00
netdevsim [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
pcs net: pcs: xpcs: fix the wrong register that was written back 2024-10-01 11:00:50 +02:00
phy net: phy: Remove LED entry from LEDs list on unregister 2024-10-07 17:15:50 -07:00
plip
ppp Including fixes from ieee802154, bluetooth and netfilter. 2024-10-03 09:44:00 -07:00
pse-pd net: pse-pd: Fix enabled status mismatch 2024-10-04 13:14:18 -07:00
slip move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
team netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
thunderbolt
usb move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
vmxnet3
vxlan netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
wan net: wan: fsl_qmc_hdlc: Discard received CRC 2024-07-31 18:09:08 -07:00
wireguard netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
wireless move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
wwan net: wwan: qcom_bam_dmux: Fix missing pm_runtime_disable() 2024-09-27 12:39:02 +01:00
xen-netback net/xen-netback: prevent UAF in xenvif_flush_hash() 2024-08-28 17:07:42 -07:00
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
bareudp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-09-15 09:13:19 -07:00
dummy.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
eql.c
geneve.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
gtp.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
ifb.c
loopback.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
macsec.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
macvlan.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
netconsole.c net: netconsole: Populate dynamic entry even if netpoll fails 2024-08-26 09:25:44 -07:00
netkit.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-09-15 09:13:19 -07:00
nlmon.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
ntb_netdev.c
pfcp.c
rionet.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
sb1000.c
sungem_phy.c net: sungem_phy: Constify struct mii_phy_def 2024-08-08 19:59:06 -07:00
tap.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
tun.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
veth.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
virtio_net.c virtio_net: Fix mismatched buf address when unmapping for small packets 2024-09-26 10:35:27 +02:00
vrf.c vrf: revert "vrf: Remove unnecessary RCU-bh critical section" 2024-10-02 17:26:11 -07:00
vsockmon.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
xen-netfront.c