linux/drivers
Laurentiu Tudor 303c9c63ab bus: fsl-mc: don't assume child devices are all fsl-mc devices
Changes in VFIO caused a pseudo-device to be created as child of
fsl-mc devices causing a crash [1] when trying to bind a fsl-mc
device to VFIO. Fix this by checking the device type when enumerating
fsl-mc child devices.

[1]
Modules linked in:
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
CPU: 6 PID: 1289 Comm: sh Not tainted 6.2.0-rc5-00047-g7c46948a6e9c #2
Hardware name: NXP Layerscape LX2160ARDB (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mc_send_command+0x24/0x1f0
lr : dprc_get_obj_region+0xfc/0x1c0
sp : ffff80000a88b900
x29: ffff80000a88b900 x28: ffff48a9429e1400 x27: 00000000000002b2
x26: ffff48a9429e1718 x25: 0000000000000000 x24: 0000000000000000
x23: ffffd59331ba3918 x22: ffffd59331ba3000 x21: 0000000000000000
x20: ffff80000a88b9b8 x19: 0000000000000000 x18: 0000000000000001
x17: 7270642f636d2d6c x16: 73662e3030303030 x15: ffffffffffffffff
x14: ffffd59330f1d668 x13: ffff48a8727dc389 x12: ffff48a8727dc386
x11: 0000000000000002 x10: 00008ceaf02f35d4 x9 : 0000000000000012
x8 : 0000000000000000 x7 : 0000000000000006 x6 : ffff80000a88bab0
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000a88b9e8
x2 : ffff80000a88b9e8 x1 : 0000000000000000 x0 : ffff48a945142b80
Call trace:
 mc_send_command+0x24/0x1f0
 dprc_get_obj_region+0xfc/0x1c0
 fsl_mc_device_add+0x340/0x590
 fsl_mc_obj_device_add+0xd0/0xf8
 dprc_scan_objects+0x1c4/0x340
 dprc_scan_container+0x38/0x60
 vfio_fsl_mc_probe+0x9c/0xf8
 fsl_mc_driver_probe+0x24/0x70
 really_probe+0xbc/0x2a8
 __driver_probe_device+0x78/0xe0
 device_driver_attach+0x30/0x68
 bind_store+0xa8/0x130
 drv_attr_store+0x24/0x38
 sysfs_kf_write+0x44/0x60
 kernfs_fop_write_iter+0x128/0x1b8
 vfs_write+0x334/0x448
 ksys_write+0x68/0xf0
 __arm64_sys_write+0x1c/0x28
 invoke_syscall+0x44/0x108
 el0_svc_common.constprop.1+0x94/0xf8
 do_el0_svc+0x38/0xb0
 el0_svc+0x20/0x50
 el0t_64_sync_handler+0x98/0xc0
 el0t_64_sync+0x174/0x178
Code: aa0103f4 a9025bf5 d5384100 b9400801 (79401260)
---[ end trace 0000000000000000 ]---

Fixes: 3c28a76124 ("vfio: Add struct device to vfio_device")
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Message-ID: <20230613160718.29500-1-laurentiu.tudor@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 13:42:18 +02:00
..
accel accel/qaic: Fix NNC message corruption 2023-05-23 09:51:38 -06:00
accessibility speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO 2023-05-31 19:17:40 +01:00
acpi First batch of EFI fixes for v6.4: 2023-06-01 20:43:11 -04:00
amba ARM: tegra: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:50 -07:00
android Merge v6.4-rc4 into char-misc-next 2023-05-28 14:55:30 +01:00
ata ata: libata-scsi: Use correct device no in ata_find_dev() 2023-05-30 08:08:18 +09:00
atm
auxdisplay
base Char/Misc driver fixes for 6.4-rc5 2023-06-04 08:32:30 -04:00
bcma bcma: Add explicit of_device.h include 2023-04-14 15:32:56 +03:00
block xen: branch for v6.4-rc4 2023-05-27 09:42:56 -07:00
bluetooth Bluetooth: btnxpuart: Fix compiler warnings 2023-05-19 15:38:29 -07:00
bus bus: fsl-mc: don't assume child devices are all fsl-mc devices 2023-06-15 13:42:18 +02:00
cdrom
cdx cdx: Replace custom mcdi logging with print_hex_dump_debug() 2023-06-15 13:42:16 +02:00
char Merge 6.4-rc5 into char-misc-next 2023-06-05 07:19:18 +02:00
clk A couple more patches that would be good to get into -rc1. 2023-05-07 10:31:45 -07:00
clocksource Timekeeping and clocksource/event driver updates the second batch: 2023-04-29 10:24:30 -07:00
comedi comedi: add HAS_IOPORT dependencies 2023-05-31 19:17:29 +01:00
connector
counter First set of Counter updates for the 6.5 cycle 2023-06-15 13:07:59 +02:00
cpufreq cpufreq: amd-pstate: Update policy->cur in amd_pstate_adjust_perf() 2023-05-25 19:35:13 +02:00
cpuidle RISC-V: Align SBI probe implementation with spec 2023-04-29 13:04:50 -07:00
crypto This push fixes the following problems: 2023-05-07 10:57:14 -07:00
cxl cxl: Explicitly initialize resources when media is not ready 2023-05-26 13:34:39 -07:00
dax
dca Mainly singleton patches all over the place. Series of note are: 2023-04-27 19:57:00 -07:00
devfreq Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
dio
dma dmaengine: at_hdmac: Extend the Flow Controller bitfield to three bits 2023-05-24 11:20:28 +05:30
dma-buf - Nick Piggin's "shoot lazy tlbs" series, to improve the peformance of 2023-04-27 19:42:02 -07:00
edac Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
eisa
extcon
firewire firewire: net: fix unexpected release of object for asynchronous request packet 2023-05-11 09:06:49 +09:00
firmware firmware: stratix10-svc: Fix a potential resource leak in svc_create_memory_pool() 2023-06-15 13:42:18 +02:00
fpga fpga: zynq-fpga: Ensure proper xCAP interface switch 2023-06-06 19:14:19 +08:00
fsi
gnss
gpio gpio-f7188x: fix chip name and pin count on Nuvoton chip 2023-05-23 10:47:41 +02:00
gpu Merge tag 'drm-intel-fixes-2023-06-01' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes 2023-06-02 10:33:29 +10:00
greybus
hid for-linus-2023060101 2023-06-01 09:02:04 -04:00
hsi
hte Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
hv hyperv-next for v6.4 2023-04-27 17:17:12 -07:00
hwmon hwmon: (k10temp) Add PCI ID for family 19, model 78h 2023-05-08 11:36:19 +02:00
hwspinlock hwspinlock: remove MODULE_LICENSE in non-modules 2023-04-13 13:13:52 -07:00
hwtracing coresight: perf: Release Coresight path when alloc trace id failed 2023-05-11 11:18:21 +01:00
i2c i2c: gxp: fix build failure without CONFIG_I2C_SLAVE 2023-05-03 17:27:29 +02:00
i3c i3c: ast2600: set variable ast2600_i3c_ops storage-class-specifier to static 2023-04-30 23:50:26 +02:00
idle intel_idle: mark few variables as __read_mostly 2023-04-27 19:37:36 +02:00
iio 1st set of IIO new device support, features and cleanup for the 6.5 cycle. 2023-06-15 13:01:55 +02:00
infiniband RDMA/irdma: Fix Local Invalidate fencing 2023-05-29 14:06:29 -03:00
input Input updates for 6.4 merge window: 2023-05-01 17:18:56 -07:00
interconnect modules-6.4-rc1 2023-04-27 16:36:55 -07:00
iommu iommu/mediatek: Flush IOTLB completely only if domain has been attached 2023-06-01 11:50:13 +02:00
ipack
irqchip irqchip/gic: Correctly validate OF quirk descriptors 2023-05-30 11:01:22 +01:00
isdn mISDN: add HAS_IOPORT dependencies 2023-05-31 19:17:40 +01:00
leds leds: qcom-lpg: Fix PWM period limits 2023-06-03 17:00:28 +02:00
macintosh powerpc updates for 6.4 2023-04-28 16:24:32 -07:00
mailbox mailbox: mailbox-test: fix a locking issue in mbox_test_message_write() 2023-05-31 13:26:44 -05:00
mcb mcb-lpc: Reallocate memory region to avoid memory overlapping 2023-04-20 14:24:01 +02:00
md md/raid5: fix miscalculation of 'end_sector' in raid5_read_one_chunk() 2023-05-24 10:44:19 -07:00
media media: uvcvideo: Don't expose unsupported formats to userspace 2023-06-02 18:48:02 +01:00
memory ARM: SoC drivers for v6.4 2023-04-25 12:02:16 -07:00
memstick
message Objtool changes for v6.4: 2023-04-28 14:02:54 -07:00
mfd mfd: tps6594: Add driver for TI TPS6594 PMIC 2023-05-18 16:06:14 +01:00
misc misc: fastrpc: Create fastrpc scalar with correct buffer count 2023-06-15 13:42:18 +02:00
mmc mmc: pwrseq: sd8787: Fix WILC CHIP_EN and RESETN toggling order 2023-05-24 14:33:32 +02:00
most
mtd mtd: rawnand: marvell: don't set the NAND frequency select 2023-06-01 18:12:33 +02:00
mux mux: adg792a: Switch back to use i2c_driver's .probe() 2023-06-15 13:42:18 +02:00
net mlx5-fixes-2023-05-31 2023-06-01 10:15:43 -07:00
nfc nfcsim.c: Fix error checking for debugfs_create_dir 2023-05-26 12:18:35 +01:00
ntb
nubus
nvdimm
nvme nvme: fix the name of Zone Append for verbose logging 2023-05-31 09:21:26 -07:00
nvmem nvmem: rmem: Use NVMEM_DEVID_AUTO 2023-06-15 13:42:18 +02:00
of Devicetree fixes for 6.4, part 1: 2023-05-05 13:27:59 -07:00
opp Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
parisc parisc: Replace regular spinlock with spin_trylock on panic path 2023-05-03 17:43:26 +02:00
parport parport: PC style parport depends on HAS_IOPORT 2023-05-31 19:17:40 +01:00
pci PCI/DPC: Quirk PIO log size for Intel Ice Lake Root Ports 2023-05-11 17:38:46 -05:00
pcmcia pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db() 2023-06-15 13:42:18 +02:00
peci
perf RISC-V: Align SBI probe implementation with spec 2023-04-29 13:04:50 -07:00
phy phy: qcom-snps: correct struct qcom_snps_hsphy kerneldoc 2023-05-16 19:48:55 +05:30
pinctrl Pin control bulk changes for the v6.4 kernel: 2023-05-02 15:40:41 -07:00
platform platform/x86/intel/ifs: Annotate work queue on stack so object debug does not complain 2023-05-23 12:55:16 +02:00
pnp
power power: supply: Fix logic checking if system is running from battery 2023-05-16 23:02:56 +02:00
powercap
pps
ps3
ptp Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
pwm pwm: Changes for v6.4-rc1 2023-05-03 11:25:01 -07:00
rapidio Mainly singleton patches all over the place. Series of note are: 2023-04-27 19:57:00 -07:00
ras
regulator regulator: mt6359: add read check for PMIC MT6359 2023-05-18 19:24:47 +09:00
remoteproc Mainly singleton patches all over the place. Series of note are: 2023-04-27 19:57:00 -07:00
reset Nothing looks out of the ordinary in this batch of clk driver updates. There 2023-04-29 17:29:39 -07:00
rpmsg Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
rtc - New Drivers 2023-05-02 10:41:31 -07:00
s390 block-6.4-2023-05-20 2023-05-20 08:48:04 -07:00
sbus Driver core changes for 6.4-rc1 2023-04-27 11:53:57 -07:00
scsi scsi: stex: Fix gcc 13 warnings 2023-05-31 11:36:40 -04:00
sh
siox
slimbus
soc soc: fsl: cpm1: Fix TSA and QMC dependencies in case of COMPILE_TEST 2023-05-30 12:25:25 +01:00
soundwire soundwire: intel_auxdevice: improve pm_prepare step 2023-04-12 15:36:55 +05:30
spi spi: spi-cadence: Interleave write of TX and read of RX FIFO 2023-05-22 11:41:05 +01:00
spmi spmi: Add a check for remove callback when removing a SPMI driver 2023-04-20 14:16:39 +02:00
ssb
staging 1st set of IIO new device support, features and cleanup for the 6.5 cycle. 2023-06-15 13:01:55 +02:00
target scsi: target: iscsi: Prevent login threads from racing between each other 2023-05-22 16:29:39 -04:00
tc
tee Fixes an uninitialized variable in OP-TEE driver 2023-05-25 17:16:52 +02:00
thermal thermal: intel: int340x: Add new line for UUID display 2023-05-24 19:50:04 +02:00
thunderbolt thunderbolt: Clear registers properly when auto clear isn't in use 2023-05-09 09:39:03 +03:00
tty serial: cpm_uart: Fix a COMPILE_TEST dependency 2023-05-30 12:25:47 +01:00
ufs scsi: ufs: core: Fix MCQ nr_hw_queues 2023-05-16 21:07:26 -04:00
uio uio: dfl: add vendor-specific feature id 2023-05-31 19:00:37 +01:00
usb usb: typec: tps6598x: Fix broken polling mode after system suspend/resume 2023-05-30 15:29:41 +01:00
vdpa virtio,vhost,vdpa: features, fixes, cleanups 2023-04-27 17:05:34 -07:00
vfio vfio/type1: check pfn valid before converting to struct page 2023-05-23 14:16:29 -06:00
vhost fork, vhost: Use CLONE_THREAD to fix freezer/ps regression 2023-06-01 17:15:33 -04:00
video fbdev: bw2: Convert to platform remove callback returning void 2023-05-30 18:33:25 +02:00
virt Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
virtio - Nick Piggin's "shoot lazy tlbs" series, to improve the peformance of 2023-04-27 19:42:02 -07:00
vlynq
w1 w1: Replace usage of found with dedicated list iterator variable 2023-05-13 21:15:02 +02:00
watchdog linux-watchdog 6.4-rc1 tag 2023-05-04 18:33:56 -07:00
xen xen: branch for v6.4-rc4 2023-05-27 09:42:56 -07:00
zorro
Kconfig
Makefile