openwrt-mirror/target/linux
Hauke Mehrtens 66f6c20e45 lantiq: Fix an sleeping function called from invalid context
The ifx_pcie_bus_enum_hack() function is called in
ifx_pcie_read_config() while holding the ifx_pcie_lock spinlock. The
ifx_pcie_bus_enum_hack() function calls pci_get_slot() which could
sleep. Add a new function for pci_get_slot() which does not use a
semaphore, the mutex should be sufficient. This fixes the sleep in
atomic context which could cause a hang of the system.

This fixes the following warning seen with
CONFIG_KERNEL_DEBUG_ATOMIC_SLEEP=y.

[   12.264300] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[   12.272226] BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1487
[   12.280684] in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 9, name: kworker/u4:0
[   12.288781] CPU: 0 PID: 9 Comm: kworker/u4:0 Not tainted 5.15.134 #0
[   12.295135] Workqueue: events_unbound deferred_probe_work_func
[   12.300964] Stack : 80e70000 8008ac80 00000000 00000004 807c776c 8145b9ec 81424c00 800520ec
[   12.309316]         808a0000 8145ba2b 8145b844 8145b838 80414178 00000001 8145b9f8 81439ea0
[   12.317674]         00000000 00000000 807c776c 8145b838 ffffefff 00000000 00000000 ffffffea
[   12.326030]         00000081 8145b844 00000081 808a6f50 807c776c 00000000 00000000 80910000
[   12.334391]         00111bef 00000000 00000001 00000000 00000018 00000030 00000000 80e40000
[   12.342741]         ...
[   12.345177] Call Trace:
[   12.347613] [<8000c1d0>] show_stack+0x28/0xf0
[   12.351974] [<8038ba1c>] dump_stack_lvl+0x60/0x80
[   12.356667] [<8005eefc>] ___might_sleep+0x124/0x138
[   12.361547] [<806daf30>] down_read+0x24/0x88
[   12.365807] [<803cdd20>] pci_get_slot+0x2c/0xc0
[   12.370333] [<806d56ac>] ifx_pcie_read_config+0x164/0x330
[   12.375735] [<803be610>] pci_bus_read_config_dword+0x6c/0xd0
[   12.381399] [<803c20cc>] pci_bus_generic_read_dev_vendor_id+0x3c/0x1a8
[   12.387915] [<803c27ec>] pci_scan_single_device+0x88/0x154
[   12.393404] [<803c2928>] pci_scan_slot+0x70/0x134
[   12.398099] [<803c3bf0>] pci_scan_child_bus_extend+0x5c/0x320
[   12.403849] [<803c4178>] pci_scan_root_bus_bridge+0xd0/0xec
[   12.409414] [<806d45a8>] pcibios_scanbus+0xe4/0x21c
[   12.414293] [<806d4908>] register_pci_controller+0xb8/0x11c
[   12.419858] [<806d5f9c>] ifx_pcie_bios_probe+0x724/0x940
[   12.425174] [<80417574>] platform_probe+0x38/0x90
[   12.429868] [<80414d68>] really_probe.part.0+0xac/0x354
[   12.435103] [<80415298>] driver_probe_device+0x4c/0x154
[   12.440313] [<80415904>] __device_attach_driver+0xd0/0x15c
[   12.445802] [<804129d8>] bus_for_each_drv+0x70/0xb0
[   12.450676] [<80415610>] __device_attach+0xdc/0x194
[   12.455545] [<80413ca8>] bus_probe_device+0x9c/0xb8
[   12.460419] [<8041420c>] deferred_probe_work_func+0x94/0xd4
[   12.465995] [<8004fcb4>] process_one_work+0x27c/0x4c8
[   12.471044] [<80050710>] worker_thread+0x34c/0x5f8
[   12.475825] [<800587a8>] kthread+0x168/0x18c
[   12.480090] [<80006ef8>] ret_from_kernel_thread+0x14/0x1c

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-10-10 00:22:25 +02:00
..
airoha kernel: bump 5.15 to 5.15.125 2023-08-09 22:06:24 +02:00
apm821xx kernel: bump 6.1 to 6.1.53 2023-09-23 13:10:28 +02:00
archs38 treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
armsr armsr: armv8: Enable KASLR in kernel 6.1 2023-10-05 21:57:17 +02:00
at91 treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
ath25 kernel: bump 5.15 to 5.15.125 2023-08-09 22:06:24 +02:00
ath79 ath79: add WWAN serial driver for GL.iNET GL-XE300 2023-10-09 12:47:41 +02:00
bcm27xx kernel: bump 6.1 to 6.1.53 2023-09-23 13:10:28 +02:00
bcm47xx kernel: bump 5.15 to 5.15.133 2023-10-04 21:03:12 +02:00
bcm53xx kernel: bump 6.1 to 6.1.56 2023-10-08 14:01:47 +02:00
bcm63xx kernel: bump 5.15 to 5.15.125 2023-08-09 22:06:24 +02:00
bcm4908 kernel: bump 5.15 to 5.15.133 2023-10-04 21:03:12 +02:00
bmips kernel: bump 6.1 to 6.1.53 2023-09-23 13:10:28 +02:00
gemini gemini: Drop kernel v5.15 and default to v6.1 2023-10-04 15:01:29 +02:00
generic kernel: bump 6.1 to 6.1.56 2023-10-08 14:01:47 +02:00
imx kernel: backport NVMEM patches queued for the v6.5 2023-06-16 09:45:38 +02:00
ipq40xx ipq40xx: use upstreamed SDI disable support 2023-10-02 19:03:30 +02:00
ipq806x ipq806x: fix broken onhub dtsi 2023-10-09 11:17:25 +02:00
kirkwood kirkwood: add support for Iomega Storcenter ix4-200d 2023-05-20 15:35:37 +02:00
lantiq lantiq: Fix an sleeping function called from invalid context 2023-10-10 00:22:25 +02:00
layerscape generic: sync MediaTek Ethernet driver with upstream 2023-08-28 16:35:22 +01:00
malta kernel: remove CRYPTO_BLAKE2S from all >=5.15 2023-07-08 16:54:01 +02:00
mediatek kernel: bump 6.1 to 6.1.56 2023-10-08 14:01:47 +02:00
mpc85xx mpc85xx: add Enterasys WS-AP3715i reset button 2023-09-27 23:13:36 +02:00
mvebu mvebu: eDPU: add support for version with external switch 2023-09-19 12:12:17 +02:00
mxs mxs: add testing kernel 6.1 2023-07-01 12:54:30 +02:00
octeon kernel: bump 5.15 to 5.15.125 2023-08-09 22:06:24 +02:00
octeontx kernel: bump 5.15 to 5.15.123 2023-07-30 18:02:47 +02:00
omap treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
oxnas kernel: bump 5.15 to 5.15.133 2023-10-04 21:03:12 +02:00
pistachio kernel: bump 5.15 to 5.15.132 2023-09-20 14:13:00 +02:00
qoriq kernel: fix handling of CONFIG_DYNAMIC_DEBUG 2023-05-03 10:26:17 -07:00
qualcommax ipq807x: add support for Netgear WAX620 2023-09-24 13:09:16 +02:00
ramips ramips: convert MT7915 EEPROM to NVMEM format 2023-10-09 11:15:52 +02:00
realtek realtek: add support for HPE 1920-8g-poe+ (65W) 2023-10-09 19:29:45 +02:00
rockchip rockchip: add support for Radxa ROCK Pi E 2023-09-05 00:20:51 +05:30
sifiveu sifiveu: refresh 6.1 config 2023-09-28 14:04:54 +02:00
sunxi sunxi: generalize top-level BOARDNAME and update suported SoCs 2023-09-24 18:16:40 +02:00
tegra treewide: remove files for building 5.10 kernel 2023-05-12 13:02:43 +02:00
uml kernel: bump 6.1 to 6.1.53 2023-09-23 13:10:28 +02:00
x86 kernel: add missing symbols 2023-09-25 18:11:20 +02:00
zynq generic: enable CONFIG_ARM_CRYPTO for 32bit arm targets 2023-05-10 19:01:45 +02:00
Makefile build: fix issues with targets installed via feeds 2022-09-27 13:41:12 +02:00