linux/drivers/net/ethernet
Edward Cree 446f556793 sfc: fix crash when reading stats while NIC is resetting
[ Upstream commit d1b355438b ]

efx_net_stats() (.ndo_get_stats64) can be called during an ethtool
 selftest, during which time nic_data->mc_stats is NULL as the NIC has
 been fini'd.  In this case do not attempt to fetch the latest stats
 from the hardware, else we will crash on a NULL dereference:
    BUG: kernel NULL pointer dereference, address: 0000000000000038
    RIP efx_nic_update_stats
    abridged calltrace:
    efx_ef10_update_stats_pf
    efx_net_stats
    dev_get_stats
    dev_seq_printf_stats
Skipping the read is safe, we will simply give out stale stats.
To ensure that the free in efx_ef10_fini_nic() does not race against
 efx_ef10_update_stats_pf(), which could cause a TOCTTOU bug, take the
 efx->stats_lock in fini_nic (it is already held across update_stats).

Fixes: d3142c193d ("sfc: refactor EF10 stats handling")
Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-19 16:21:13 +02:00
..
3com 3c589_cs: Fix an error handling path in tc589_probe() 2023-05-30 14:03:33 +01:00
8390
actions
adaptec
adi net: ethernet: adi: adin1110: Fix multicast offloading 2023-02-01 08:34:45 +01:00
aeroflex ethernet: aeroflex: fix potential skb leak in greth_init_rings() 2022-12-07 11:45:52 +01:00
agere
alacritech
allwinner
alteon
altera net: altera_tse: release phylink resources in tse_shutdown() 2022-11-24 09:34:43 +01:00
amazon net: ena: Update NUMA TPH hint register upon NUMA node update 2023-01-12 12:02:19 +01:00
amd amd-xgbe: fix the false linkup in xgbe_phy_status 2023-06-09 10:34:01 +02:00
apm drivers: net: xgene: disable napi when register irq failed in xgene_enet_open() 2022-11-08 15:15:55 +01:00
apple net: apple: bmac: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:27 +01:00
aquantia net: atlantic: Fix crash when XDP is enabled but no program is loaded 2023-03-22 13:33:50 +01:00
arc
asix
atheros net: ag71xx: call phylink_disconnect_phy if ag71xx_hw_enable() fail in ag71xx_open() 2022-11-15 20:22:12 -08:00
broadcom bnxt_en: Implement .set_port / .unset_port UDP tunnel callbacks 2023-06-14 11:15:23 +02:00
brocade
cadence net: macb: fix a memory corruption in extended buffer descriptor mode 2023-04-20 12:35:10 +02:00
calxeda
cavium net: thunderx: Fix missing destroy_workqueue of nicvf_rx_mode_wq 2022-12-06 12:41:46 +01:00
chelsio cxgb4vf: shut down the adapter when t4vf_update_port_info() failed in cxgb4vf_open() 2022-11-09 19:30:30 -08:00
cirrus
cisco
cortina
davicom net: dm9051: Fix missing dev_kfree_skb() in dm9051_loop_rx() 2022-11-23 12:43:14 +00:00
dec
dlink
emulex be2net: Extend xmit workaround to BE3 chip 2023-06-28 11:12:31 +02:00
engleder tsnep: Fix TX queue stop/wake for multiple queues 2023-02-01 08:34:48 +01:00
ezchip
faraday
freescale net: enetc: correct the indexes of highest and 2nd highest TCs 2023-06-21 16:00:58 +02:00
fujitsu
fungible
google gve: Remove the code of clearing PBA bit 2023-05-24 17:32:32 +01:00
hisilicon net: hns3: fix reset timeout when enable full VF 2023-05-24 17:32:45 +01:00
huawei net: hinic: Fix error handling in hinic_module_init() 2022-11-11 19:57:37 -08:00
i825xx i825xx: sni_82596: use eth_hw_addr_set() 2023-03-22 13:33:50 +01:00
ibm ibmveth: Reduce default tx queues to 8 2022-11-08 17:46:24 -08:00
intel ice: handle extts in the miscellaneous interrupt thread 2023-07-19 16:21:08 +02:00
litex
marvell octeon_ep: Add missing check for ioremap 2023-06-21 16:01:02 +02:00
mediatek net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow 2023-04-06 12:10:49 +02:00
mellanox net/mlx5: DR, Fix wrong action data allocation in decap action 2023-06-28 11:12:29 +02:00
micrel net: ksz884x: fix missing pci_disable_device() on error in pcidev_init() 2022-10-25 19:46:35 -07:00
microchip lan966x: Fix unloading/loading of the driver 2023-05-30 14:03:21 +01:00
microsoft net: mana: Fix IRQ name - add PCI and queue number 2023-02-01 08:34:42 +01:00
moxa
mscc net: mscc: ocelot: fix stat counter register values 2023-05-24 17:32:32 +01:00
myricom myri10ge: Fix an error handling path in myri10ge_probe() 2022-12-31 13:32:56 +01:00
natsemi net/sonic: use dma_mapping_error() for error check 2023-03-30 12:49:09 +02:00
neterion ethernet: s2io: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:26 +01:00
netronome nfp: ethtool: fix the bug of setting unsupported port speed 2023-02-25 11:25:41 +01:00
ni net: ethernet: nixge: fix NULL dereference 2022-11-28 11:09:51 +00:00
nvidia forcedeth: Fix an error handling path in nv_probe() 2023-05-30 14:03:32 +01:00
nxp
oki-semi net: pch_gbe: fix pci device refcount leak while module exiting 2022-11-18 19:40:14 -08:00
packetengines
pasemi net: pasemi: Fix return type of pasemi_mac_start_tx() 2023-05-24 17:32:37 +01:00
pensando ionic: catch failure from devlink_alloc 2023-05-17 11:53:37 +02:00
qlogic qed/qede: Fix scheduling while atomic 2023-06-14 11:15:19 +02:00
qualcomm net: qca_spi: Avoid high load if QCA7000 is not available 2023-06-28 11:12:30 +02:00
rdc r6040: Fix kmemleak in probe and remove 2022-12-31 13:32:54 +01:00
realtek r8169: fix RTL8168H and RTL8107E rx crc error 2023-04-06 12:10:45 +02:00
renesas sh_eth: avoid PHY being resumed when interface is not up 2023-03-22 13:33:50 +01:00
rocker treewide: use get_random_bytes() when possible 2022-10-11 17:42:58 -06:00
samsung
seeq
sfc sfc: fix crash when reading stats while NIC is resetting 2023-07-19 16:21:13 +02:00
sgi
silan
sis
smsc smsc911x: avoid PHY being resumed when interface is not up 2023-04-06 12:10:47 +02:00
socionext net: ethernet: ave: Fix MAC to be in charge of PHY PM 2022-10-26 20:21:34 -07:00
stmicro net: stmmac: fix double serdes powerdown 2023-07-19 16:21:12 +02:00
sun cassini: Fix a memory leak in the error handling path of cas_init_one() 2023-05-24 17:32:47 +01:00
sunplus eth: sp7021: drop free_netdev() from spl2sw_init_netdev() 2022-11-10 16:27:33 -08:00
synopsys
tehuti
ti net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe 2023-04-13 16:55:22 +02:00
toshiba net/ps3_gelic_net: Use dma_mapping_error 2023-03-30 12:49:07 +02:00
tundra ethernet: tundra: free irq when alloc ring failed in tsi108_open() 2022-11-10 15:39:08 +01:00
vertexcom
via
wangxun
wiznet
xilinx net: axienet: Move reset before 64-bit DMA detection 2023-07-19 16:21:12 +02:00
xircom xirc2ps_cs: Fix use after free bug in xirc2ps_detach 2023-03-30 12:49:04 +02:00
xscale
dnet.c net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:27 +01:00
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c
jme.h
Kconfig
korina.c
lantiq_etop.c net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY 2022-10-24 13:02:18 +01:00
lantiq_xrx200.c
Makefile