linux-stable/drivers
Edward Cree 470152d76b 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-11 19:39:31 +02:00
..
accel
accessibility
acpi APEI: GHES: correctly return NULL for ghes_get_devices() 2023-07-11 19:39:24 +02:00
amba
android
ata
atm
auxdisplay
base PM: domains: Move the verification of in-params from genpd_add_device() 2023-07-11 19:39:24 +02:00
bcma
block null_blk: Fix: memory release when memory_backed=1 2023-06-28 11:14:23 +02:00
bluetooth
bus
cdrom
char
clk
clocksource clocksource/drivers/cadence-ttc: Fix memory leak in ttc_timer_probe 2023-07-11 19:39:23 +02:00
comedi
connector
counter
cpufreq cpufreq: intel_pstate: Fix energy_performance_preference for passive 2023-07-11 19:39:24 +02:00
cpuidle
crypto
cxl Revert "cxl/port: Enable the HDM decoder capability for switch ports" 2023-07-05 18:29:23 +01:00
dax
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio gpiolib: Fix irq_domain resource tracking for gpiochip_irqchip_add_domain() 2023-06-28 11:14:18 +02:00
gpu drm: use mgr->dev in drm_dbg_kms in drm_dp_add_payload_part2 2023-07-11 19:39:21 +02:00
greybus
hid HID: logitech-hidpp: add HIDPP_QUIRK_DELAYED_INIT for the T651. 2023-07-01 13:14:47 +02:00
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle 2023-06-28 11:14:24 +02:00
i3c
idle
iio
infiniband
input Input: soc_button_array - add invalid acpi_index DMI quirk handling 2023-06-28 11:14:20 +02:00
interconnect
iommu mm: always expand the stack with the mmap write lock held 2023-07-01 13:14:46 +02:00
ipack
irqchip irqchip/jcore-aic: Fix missing allocation of IRQ descriptors 2023-07-11 19:39:23 +02:00
isdn
leds
macintosh
mailbox
mcb
md md/raid1-10: submit write io directly if bitmap is not enabled 2023-07-11 19:39:22 +02:00
media media: cec: core: don't set last_initiator if tx in progress 2023-06-28 11:14:19 +02:00
memory
memstick memstick r592: make memstick_debug_get_tpc_name() static 2023-07-11 19:39:29 +02:00
message
mfd
misc
mmc mmc: Add MMC_QUIRK_BROKEN_SD_CACHE for Kingston Canvas Go Plus from 11/2019 2023-07-11 19:39:30 +02:00
most
mtd
mux
net sfc: fix crash when reading stats while NIC is resetting 2023-07-11 19:39:31 +02:00
nfc nfcsim.c: Fix error checking for debugfs_create_dir 2023-06-28 11:14:19 +02:00
ntb
nubus nubus: Partially revert proc_create_single_data() conversion 2023-07-05 18:29:23 +01:00
nvdimm
nvme nvme-core: fix dev_pm_qos memleak 2023-07-11 19:39:22 +02:00
nvmem
of
opp
parisc
parport
pci PCI/ACPI: Call _REG when transitioning D-states 2023-07-05 18:29:23 +01:00
pcmcia
peci
perf perf/arm_cspmu: Fix event attribute type 2023-07-11 19:39:24 +02:00
phy
pinctrl
platform platform/x86: int3472: Avoid crash in unregistering regulator gpio 2023-06-28 11:14:21 +02:00
pnp
power
powercap powercap: RAPL: Fix CONFIG_IOSF_MBI dependency 2023-07-11 19:39:24 +02:00
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: core: Streamline debugfs operations 2023-07-11 19:39:27 +02:00
remoteproc
reset
rpmsg
rtc
s390 s390/cio: unregister device when the only path is gone 2023-06-28 11:14:20 +02:00
sbus
scsi
sh
siox
slimbus
soc
soundwire soundwire: qcom: add proper error paths in qcom_swrm_startup() 2023-06-28 11:14:21 +02:00
spi spi: dw: Round of n_bytes to power of 2 2023-07-11 19:39:27 +02:00
spmi
ssb
staging
target scsi: target: iscsi: Prevent login threads from racing between each other 2023-06-28 11:14:18 +02:00
tc
tee
thermal thermal/drivers/qoriq: Only enable supported sensors 2023-07-11 19:39:25 +02:00
thunderbolt
tty
ufs
uio
usb usb: gadget: udc: fix NULL dereference in remove() 2023-06-28 11:14:19 +02:00
vdpa
vfio
vhost vhost_net: revert upend_idx only on retriable error 2023-06-28 11:14:23 +02:00
video fbdev: fix potential OOB read in fast_imageblit() 2023-07-01 13:14:46 +02:00
virt virt: sevguest: Add CONFIG_CRYPTO dependency 2023-07-11 19:39:21 +02:00
virtio
vlynq
w1
watchdog
xen
zorro
Kconfig
Makefile