linux/drivers
Jakub Kicinski ea937f7720 net: netdevsim: don't try to destroy PHC on VFs
PHC gets initialized in nsim_init_netdevsim(), which
is only called if (nsim_dev_port_is_pf()).

Create a counterpart of nsim_init_netdevsim() and
move the mock_phc_destroy() there.

This fixes a crash trying to destroy netdevsim with
VFs instantiated, as caught by running the devlink.sh test:

    BUG: kernel NULL pointer dereference, address: 00000000000000b8
    RIP: 0010:mock_phc_destroy+0xd/0x30
    Call Trace:
     <TASK>
     nsim_destroy+0x4a/0x70 [netdevsim]
     __nsim_dev_port_del+0x47/0x70 [netdevsim]
     nsim_dev_reload_destroy+0x105/0x120 [netdevsim]
     nsim_drv_remove+0x2f/0xb0 [netdevsim]
     device_release_driver_internal+0x1a1/0x210
     bus_remove_device+0xd5/0x120
     device_del+0x159/0x490
     device_unregister+0x12/0x30
     del_device_store+0x11a/0x1a0 [netdevsim]
     kernfs_fop_write_iter+0x130/0x1d0
     vfs_write+0x30b/0x4b0
     ksys_write+0x69/0xf0
     do_syscall_64+0xcc/0x1e0
     entry_SYSCALL_64_after_hwframe+0x6f/0x77

Fixes: b63e78fca8 ("net: netdevsim: use mock PHC driver")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2024-01-17 10:56:44 +00:00
..
accel Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
accessibility
acpi platform-drivers-x86 for v6.8-1 2024-01-09 17:07:12 -08:00
amba
android Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
ata SCSI fixes on 20231130 2023-12-02 06:27:20 +09:00
atm net: fill in MODULE_DESCRIPTION()s for ATM 2024-01-05 08:04:23 -08:00
auxdisplay
base Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
bcma bcma: Use PCI_HEADER_TYPE_MASK instead of literal 2023-11-30 21:21:28 +02:00
block Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
bluetooth Bluetooth: Add device 13d3:3572 IMC Networks Bluetooth Radio 2023-12-22 13:00:11 -05:00
bus
cache
cdrom
cdx
char This update includes the following changes: 2024-01-10 12:23:43 -08:00
clk Fixes for a wrong clockname, a wrong clock-parent, a wrong clock-gate 2023-12-13 15:26:24 -08:00
clocksource
comedi
connector Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
counter
cpufreq Power management updates for 6.8-rc1 2024-01-09 16:32:11 -08:00
cpuidle cpuidle: haltpoll: Do not enable interrupts when entering idle 2023-12-29 18:08:18 +01:00
crypto This update includes the following changes: 2024-01-10 12:23:43 -08:00
cxl cxl/pmu: Ensure put_device on pmu devices 2023-12-14 21:54:45 -08:00
dax New code for 6.8: 2024-01-10 08:45:22 -08:00
dca
devfreq PM / devfreq: Synchronize devfreq_monitor_[start/stop] 2023-12-19 07:58:27 +09:00
dio
dma This update includes the following changes: 2024-01-10 12:23:43 -08:00
dma-buf
dpll dpll: expose fractional frequency offset value to user 2024-01-05 07:58:19 -08:00
edac - Convert the hw error storm handling into a finer-grained, per-bank 2024-01-08 16:03:00 -08:00
eisa
extcon
firewire firewire: ohci: suppress unexpected system reboot in AMD Ryzen machines and ASM108x/VT630x PCIe cards 2024-01-05 21:28:08 +09:00
firmware EFI updates for v6.8 2024-01-09 17:11:27 -08:00
fpga
fsi
gnss
gpio gpio: dwapb: mask/unmask IRQ when disable/enale it 2023-12-21 11:19:01 +01:00
gpu header cleanups for 6.8 2024-01-10 16:43:55 -08:00
greybus Revert "greybus: gb-beagleplay: Ensure le for values in transport" 2023-12-05 09:10:01 +09:00
hid hardening updates for v6.8-rc1 2024-01-10 11:03:52 -08:00
hsi
hte
hv
hwmon hwmon: (corsair-psu) Fix probe when built-in 2023-12-08 10:36:02 -08:00
hwspinlock
hwtracing
i2c i2c: core: Fix atomic xfer check for non-preempt config 2024-01-06 14:10:10 +01:00
i3c
idle Power management updates for 6.8-rc1 2024-01-09 16:32:11 -08:00
iio Revert "iio: hid-sensor-als: Add light color temperature support" 2023-12-19 08:08:20 +01:00
infiniband arm64 updates for 6.8 2024-01-08 16:32:09 -08:00
input spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
interconnect interconnect: qcom: icc-rpm: Fix peak rate calculation 2023-12-06 17:00:42 +02:00
iommu Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
ipack
irqchip header cleanups for 6.8 2024-01-10 16:43:55 -08:00
isdn
leds leds: trigger: netdev: fix RTNL handling to prevent potential deadlock 2023-12-06 07:36:55 -08:00
macintosh
mailbox
mcb
md Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
media Revert BPF token-related functionality 2023-12-19 08:23:03 -08:00
memory
memstick
message
mfd spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
misc hardening updates for v6.8-rc1 2024-01-10 11:03:52 -08:00
mmc spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
most
mtd * MTD 2024-01-09 15:40:59 -08:00
mux
net net: netdevsim: don't try to destroy PHC on VFs 2024-01-17 10:56:44 +00:00
nfc
ntb
nubus nubus: Make nubus_bus_type static and constant 2024-01-03 13:33:59 +01:00
nvdimm nvdimm/btt: replace deprecated strncpy with strscpy 2023-12-01 09:51:43 -08:00
nvme hardening updates for v6.8-rc1 2024-01-10 11:03:52 -08:00
nvmem nvmem: brcm_nvram: store a copy of NVRAM content 2023-12-15 13:15:02 +01:00
of Devicetree fixes for v6.7, take 1: 2023-12-07 12:22:36 -08:00
opp OPP: Rename 'rate_clk_single' 2024-01-05 15:55:41 +05:30
parisc
parport parport: Add support for Brainboxes IX/UC/PX parallel cards 2023-12-07 11:10:44 +09:00
pci Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
pcmcia
peci
perf ACPI updates for 6.8-rc1 2024-01-09 16:12:44 -08:00
phy phy fixes for 6.7 2023-12-17 09:19:27 -08:00
pinctrl Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
platform platform-drivers-x86 for v6.8-1 2024-01-09 17:07:12 -08:00
pmdomain Power management fixes for 6.7-rc4 2023-12-02 09:01:00 +09:00
pnp ACPI updates for 6.8-rc1 2024-01-09 16:12:44 -08:00
power
powercap powercap: DTPM: Fix missing cpufreq_cpu_put() calls 2023-12-05 20:51:24 +01:00
pps
ps3
ptp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-01-04 18:06:46 -08:00
pwm
rapidio rapidio/tsi721: fix kernel-doc warnings 2023-12-20 15:02:57 -08:00
ras
regulator regulator: event: Ensure atomicity for sequence number 2024-01-04 20:02:06 +00:00
remoteproc
reset reset: Fix crash when freeing non-existent optional resets 2023-11-30 15:02:21 +01:00
rpmsg
rtc
s390 Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
sbus
scsi scsi: core: Always send batch on reset or error handling command 2023-12-18 21:09:41 -05:00
sh
siox
slimbus
soc
soundwire
spi spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
spmi
ssb
staging
target pid: Split out pid_types.h 2023-12-20 19:26:31 -05:00
tc
tee OP-TEE fix for supplicant based device enumeration 2023-12-06 16:15:26 +01:00
thermal Thermal control updates for 6.8-rc1 2024-01-09 16:20:17 -08:00
thunderbolt thunderbolt: Fix minimum allocated USB 3.x and PCIe bandwidth 2023-12-08 09:03:49 +02:00
tty serial: 8250_dw: Add ACPI ID for Granite Rapids-D UART 2023-12-07 10:48:56 +09:00
ufs scsi: ufs: core: Let the sq_lock protect sq_tail_slot access 2023-12-18 21:09:54 -05:00
uio
usb spi: Updates for v6.8 2024-01-09 15:02:12 -08:00
vdpa vfs-6.8.misc 2024-01-08 10:26:08 -08:00
vfio vfs-6.8.misc 2024-01-08 10:26:08 -08:00
vhost Networking changes for 6.8. 2024-01-11 10:07:29 -08:00
video mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER 2024-01-08 15:27:15 -08:00
virt - Convert the sev-guest plaform ->remove callback to return void 2024-01-08 15:42:52 -08:00
virtio Many singleton patches against the MM code. The patch series which 2024-01-09 11:18:47 -08:00
w1
watchdog
xen vfs-6.8.misc 2024-01-08 10:26:08 -08:00
zorro
Kconfig
Makefile