mirror-linux/drivers
Moshe Shemesh ddf458641a net/mlx5: Fix command stats access after free
[ Upstream commit da2e552b46 ]

Command may fail while driver is reloading and can't accept FW commands
till command interface is reinitialized. Such command failure is being
logged to command stats. This results in NULL pointer access as command
stats structure is being freed and reallocated during mlx5 devlink
reload (see kernel log below).

Fix it by making command stats statically allocated on driver probe.

Kernel log:
[ 2394.808802] BUG: unable to handle kernel paging request at 000000000002a9c0
[ 2394.810610] PGD 0 P4D 0
[ 2394.811811] Oops: 0002 [#1] SMP NOPTI
...
[ 2394.815482] RIP: 0010:native_queued_spin_lock_slowpath+0x183/0x1d0
...
[ 2394.829505] Call Trace:
[ 2394.830667]  _raw_spin_lock_irq+0x23/0x26
[ 2394.831858]  cmd_status_err+0x55/0x110 [mlx5_core]
[ 2394.833020]  mlx5_access_reg+0xe7/0x150 [mlx5_core]
[ 2394.834175]  mlx5_query_port_ptys+0x78/0xa0 [mlx5_core]
[ 2394.835337]  mlx5e_ethtool_get_link_ksettings+0x74/0x590 [mlx5_core]
[ 2394.836454]  ? kmem_cache_alloc_trace+0x140/0x1c0
[ 2394.837562]  __rh_call_get_link_ksettings+0x33/0x100
[ 2394.838663]  ? __rtnl_unlock+0x25/0x50
[ 2394.839755]  __ethtool_get_link_ksettings+0x72/0x150
[ 2394.840862]  duplex_show+0x6e/0xc0
[ 2394.841963]  dev_attr_show+0x1c/0x40
[ 2394.843048]  sysfs_kf_seq_show+0x9b/0x100
[ 2394.844123]  seq_read+0x153/0x410
[ 2394.845187]  vfs_read+0x91/0x140
[ 2394.846226]  ksys_read+0x4f/0xb0
[ 2394.847234]  do_syscall_64+0x5b/0x1a0
[ 2394.848228]  entry_SYSCALL_64_after_hwframe+0x65/0xca

Fixes: 34f46ae0d4 ("net/mlx5: Add command failures data to debugfs")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-18 11:58:29 +01:00
..
accessibility speakup: replace utils' u_char with unsigned char 2022-11-09 15:25:24 +01:00
acpi ACPI: video: Allow selecting NVidia-WMI-EC or Apple GMUX backlight from the cmdline 2023-01-18 11:58:15 +01:00
amba
android binder: validate alloc->mm in ->mmap() handler 2022-11-09 15:41:27 +01:00
ata ata: ahci: fix enum constants for gcc-13 2023-01-07 11:11:46 +01:00
atm
auxdisplay
base driver core: Fix bus_type.match() error handling in __driver_attach() 2023-01-07 11:11:54 +01:00
bcma
block virtio_blk: Fix signedness bug in virtblk_prep_rq() 2023-01-12 12:02:54 +01:00
bluetooth Bluetooth: hci_bcm: Add CYW4373A0 support 2022-12-31 13:33:05 +01:00
bus bus: mhi: host: Fix race between channel preparation and M0 event 2023-01-07 11:11:54 +01:00
cdrom
char tpm: Allow system suspend to continue when TPM suspend fails 2023-01-12 12:02:49 +01:00
clk clk: imx: imx8mp: add shared clk gate for usb suspend clk 2022-12-31 13:33:09 +01:00
clocksource clocksource/drivers/timer-ti-dm: Fix missing clk_disable_unprepare in dmtimer_systimer_init_clock() 2022-12-31 13:31:59 +01:00
comedi
connector
counter counter: stm32-lptimer-cnt: fix the check on arr and cmp registers update 2022-12-31 13:32:41 +01:00
cpufreq cpufreq: amd-pstate: fix kernel hang issue while amd-pstate unregistering 2023-01-18 11:58:12 +01:00
cpuidle cpuidle: dt: Return the correct numbers of parsed idle states 2022-12-31 13:31:55 +01:00
crypto virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session() 2023-01-12 12:02:08 +01:00
cxl cxl/region: Fix missing probe failure 2023-01-07 11:11:39 +01:00
dax device-dax: Fix duplicate 'hmem' device registration 2022-11-21 15:34:40 -08:00
dca
devfreq PM/devfreq: governor: Add a private governor_data for governor 2023-01-07 11:11:40 +01:00
dio drivers: dio: fix possible memory leak in dio_init() 2022-12-31 13:32:38 +01:00
dma dmaengine: idxd: Make read buffer sysfs attributes invisible for Intel IAA 2022-12-31 13:32:47 +01:00
dma-buf dma-buf: fix racing conflict of dma_heap_add() 2022-11-22 18:27:56 +05:30
edac EDAC/device: Fix period calculation in edac_device_reset_delay_period() 2023-01-18 11:58:22 +01:00
eisa
extcon extcon: usbc-tusb320: Update state on probe even if no IRQ pending 2022-12-31 13:32:39 +01:00
firewire
firmware firmware/psci: Don't register with debugfs if PSCI isn't available 2023-01-18 11:58:16 +01:00
fpga fpga: m10bmc-sec: Fix kconfig dependencies 2022-11-15 21:46:58 +08:00
fsi
gnss
gpio gpio: sifive: Fix refcount leak in sifive_gpio_probe 2023-01-12 12:02:24 +01:00
gpu drm/vmwgfx: Remove rcu locks from user resources 2023-01-18 11:58:28 +01:00
greybus
hid HID: Ignore HP Envy x360 eu0009nv stylus battery 2023-01-07 11:11:43 +01:00
hsi HSI: omap_ssi_core: Fix error handling in ssi_init() 2022-12-31 13:32:45 +01:00
hte
hv video: hyperv_fb: Avoid taking busy spinlock on panic path 2022-12-31 13:32:56 +01:00
hwmon hwmon: (jc42) Fix missing unlock on error in jc42_write() 2022-12-31 13:33:06 +01:00
hwspinlock
hwtracing coresight: cti: Fix null pointer error on CTI init before ETM 2022-12-31 13:32:41 +01:00
i2c i2c: ismt: Fix an out-of-bounds bug in ismt_access() 2022-12-31 13:32:42 +01:00
i3c
idle
iio iio: addac: ad74413r: fix integer promotion bug in ad74413_get_input_current_offset() 2022-12-31 13:33:10 +01:00
infiniband RDMA/mlx5: Fix validation of max_rd_atomic caps for DC 2023-01-12 12:02:21 +01:00
input Input: iqs7222 - add support for IQS7222A v1.13+ 2022-12-31 13:33:08 +01:00
interconnect interconnect: qcom: sc7180: fix dropped const of qcom_icc_bcm 2022-12-31 13:32:39 +01:00
iommu iommu/arm-smmu: Report IOMMU_CAP_CACHE_COHERENCY even betterer 2023-01-18 11:58:21 +01:00
ipack
irqchip irqchip/loongson-liointc: Fix improper error handling in liointc_init() 2022-12-31 13:31:57 +01:00
isdn mISDN: hfcmulti: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave() 2022-12-31 13:32:53 +01:00
leds leds: is31fl319x: Fix setting current limit for is31fl319{0,1,3} 2022-12-31 13:32:45 +01:00
macintosh macintosh/macio-adb: check the return value of ioremap() 2022-12-31 13:32:50 +01:00
mailbox mailbox: zynq-ipi: fix error handling while device_register() fails 2022-12-31 13:32:55 +01:00
mcb mcb: mcb-parse: fix error handing in chameleon_parse_gdd() 2022-12-31 13:32:41 +01:00
md md/bitmap: Fix bitmap chunk size overflow issues 2023-01-07 11:11:51 +01:00
media media: dvb-core: Fix UAF due to refcount races at releasing 2023-01-07 11:11:49 +01:00
memory memory: renesas-rpc-if: Clear HS bit during hardware initialization 2022-12-31 13:31:48 +01:00
memstick memstick/ms_block: Add check for alloc_ordered_workqueue 2022-12-31 13:32:25 +01:00
message
mfd mfd: mt6360: Add bounds checking in Regmap read/write call-backs 2023-01-04 11:29:01 +01:00
misc lkdtm: cfi: Make PAC test work with GCC 7 and 8 2022-12-31 13:33:07 +01:00
mmc mmc: sdhci-sprd: Disable CLK_AUTO when the clock is less than 400K 2023-01-07 11:11:37 +01:00
most
mtd mtd: cfi: allow building spi-intel standalone 2023-01-18 11:58:24 +01:00
mux
net net/mlx5: Fix command stats access after free 2023-01-18 11:58:29 +01:00
nfc nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame() 2023-01-18 11:58:26 +01:00
ntb
nubus
nvdimm
nvme nvme: also return I/O command effects from nvme_command_effects 2023-01-12 12:02:42 +01:00
nvmem nvmem: lan9662-otp: Change return type of lan9662_otp_wait_flag_clear() 2022-11-22 18:22:05 +01:00
of of/fdt: run soc memory setup when early_init_dt_scan_memory fails 2023-01-12 12:02:51 +01:00
opp
parisc parisc: led: Fix potential null-ptr-deref in start_task() 2023-01-07 11:11:55 +01:00
parport parport_pc: Avoid FIFO port location truncation 2022-11-09 15:40:32 +01:00
pci PCI/sysfs: Fix double free in error path 2023-01-07 11:11:53 +01:00
pcmcia
peci
perf drivers/perf: hisi: Fix some event id for hisi-pcie-pmu 2022-12-31 13:31:53 +01:00
phy phy: qcom-qmp-combo: fix broken power on 2023-01-12 12:01:56 +01:00
pinctrl pinctrl: thunderbay: fix possible memory leak in thunderbay_build_functions() 2022-12-31 13:32:23 +01:00
platform platform/x86: sony-laptop: Don't turn off 0x153 keyboard backlight during probe 2023-01-18 11:58:18 +01:00
pnp PNP: fix name memory leak in pnp_alloc_dev() 2022-12-31 13:31:56 +01:00
power power: supply: fix null pointer dereferencing in power_supply_get_battery_info 2022-12-31 13:32:45 +01:00
powercap
pps
ps3
ptp
pwm pwm: tegra: Fix 32 bit build 2022-12-31 13:33:12 +01:00
rapidio rapidio: devices: fix missing put_device in mport_cdev_open 2022-12-31 13:32:00 +01:00
ras
regulator regulator: da9211: Use irq handler when ready 2023-01-18 11:58:22 +01:00
remoteproc remoteproc: imx_rproc: Correct i.MX93 DRAM mapping 2023-01-07 11:11:55 +01:00
reset
rpmsg
rtc rtc: ds1347: fix value written to century register 2023-01-07 11:11:50 +01:00
s390 s390/lcs: Fix return type of lcs_start_xmit() 2022-12-31 13:33:01 +01:00
sbus
scsi scsi: mpi3mr: Refer CONFIG_SCSI_MPI3MR in Makefile 2023-01-18 11:58:23 +01:00
sh
siox siox: fix possible memory leak in siox_device_add() 2022-11-09 15:40:14 +01:00
slimbus slimbus: qcom-ngd: Fix build error when CONFIG_SLIM_QCOM_NGD_CTRL=y && CONFIG_QCOM_RPROC_COMMON=m 2022-11-10 18:45:40 +01:00
soc ARM: ux500: do not directly dereference __iomem 2023-01-07 11:11:38 +01:00
soundwire soundwire: dmi-quirks: add quirk variant for LAPBC710 NUC15 2023-01-04 11:28:56 +01:00
spi spi: fsl_spi: Don't change speed while chipselect is active 2022-12-31 13:33:11 +01:00
spmi
ssb
staging ipu3-imgu: Fix NULL pointer dereference in imgu_subdev_set_selection() 2023-01-07 11:11:51 +01:00
target scsi: target: iscsi: Fix a race condition between login_work and the login thread 2022-12-31 13:33:06 +01:00
tc
tee tee: optee: fix possible memory leak in optee_register_device() 2022-11-17 09:22:12 +01:00
thermal thermal: int340x: Add missing attribute for data rate base 2023-01-12 12:02:50 +01:00
thunderbolt
tty hvc/xen: lock console list traversal 2023-01-18 11:58:26 +01:00
ufs scsi: ufs: core: WLUN suspend SSU/enter hibern8 fail recovery 2023-01-18 11:58:23 +01:00
uio uio: uio_dmem_genirq: Fix deadlock between irq config and handling 2022-12-31 13:32:38 +01:00
usb usb: ulpi: defer ulpi_register on ulpi_read_id timeout 2023-01-18 11:58:19 +01:00
vdpa vdpasim: fix memory leak when freeing IOTLBs 2023-01-12 12:02:09 +01:00
vfio vfio/iova_bitmap: refactor iova_bitmap_set() to better handle page boundaries 2022-12-31 13:32:41 +01:00
vhost vhost_vdpa: fix the crash in unmap a large memory 2023-01-12 12:02:49 +01:00
video fbdev: matroxfb: G200eW: Increase max memory from 1 MB to 16 MB 2023-01-12 12:02:44 +01:00
virt virt/sev-guest: Add a MODULE_ALIAS 2022-12-31 13:32:09 +01:00
virtio
vlynq
w1
watchdog watchdog: iTCO_wdt: Set NO_REBOOT if the watchdog is not already running 2022-12-31 13:32:44 +01:00
xen xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource() 2022-12-31 13:31:59 +01:00
zorro
Kconfig
Makefile