linux-stable/drivers/soc
Jon Hunter 81b3f0efbb soc/tegra: fuse: Fix crash in tegra_fuse_readl()
Commit c5b2d43e67bb ("soc/tegra: fuse: Add ACPI support for Tegra194 and
Tegra234") updated the Tegra fuse driver to add ACPI support and added a
test to the tegra_fuse_readl() function to check if the device is
booting with device-tree. This test passes 'fuse->dev' variable to
dev_fwnode() but does not check first is 'fuse->dev' is valid. This is
causing a crash to occur in Tegra XUSB PHY driver that calls the
tegra_fuse_readl() function before 'fuse->dev' variable has been
initialised ...

 Unable to handle kernel NULL pointer dereference at virtual address 0000000000000290
 Mem abort info:
   ESR = 0x0000000096000004
   EC = 0x25: DABT (current EL), IL = 32 bits
   SET = 0, FnV = 0
   EA = 0, S1PTW = 0
   FSC = 0x04: level 0 translation fault
 Data abort info:
   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
 [0000000000000290] user address but active_mm is swapper
 Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
 Modules linked in:
 CPU: 7 PID: 70 Comm: kworker/u16:4 Not tainted 6.8.0-rc1-next-20240129-02825-g596764183be8 #1
 Hardware name: NVIDIA Jetson AGX Xavier Developer Kit (DT)
 Workqueue: events_unbound deferred_probe_work_func
 pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : __dev_fwnode+0x0/0x18
 lr : tegra_fuse_readl+0x24/0x98
 sp : ffff80008393ba10
 x29: ffff80008393ba10 x28: 0000000000000000 x27: ffff800081233c10
 x26: 00000000000001c8 x25: ffff000080b7bc10 x24: ffff000082df3b00
 x23: fffffffffffffff4 x22: 0000000000000004 x21: ffff80008393ba84
 x20: 00000000000000f0 x19: ffff800082f1e000 x18: ffff800081d72000
 x17: 0000000000000001 x16: 0000000000000001 x15: ffff800082fcdfff
 x14: 0000000000000000 x13: 0000000003541000 x12: 0000000000000020
 x11: 0140000000000000 x10: ffff800080000000 x9 : 0000000000000000
 x8 : ffff000082df3b40 x7 : 0000000000000000 x6 : 000000000000003f
 x5 : 00000000ffffffff x4 : 0000000000000dc0 x3 : 00000000000000c0
 x2 : 0000000000000001 x1 : ffff80008393ba84 x0 : 0000000000000000
 Call trace:
  __dev_fwnode+0x0/0x18
  tegra186_xusb_padctl_probe+0xb0/0x1a8
  tegra_xusb_padctl_probe+0x7c/0xebc
  platform_probe+0x90/0xd8
  really_probe+0x13c/0x29c
  __driver_probe_device+0x7c/0x124
  driver_probe_device+0x38/0x11c
  __device_attach_driver+0x90/0xdc
  bus_for_each_drv+0x78/0xdc
  __device_attach+0xfc/0x188
  device_initial_probe+0x10/0x18
  bus_probe_device+0xa4/0xa8
  deferred_probe_work_func+0x80/0xb4
  process_scheduled_works+0x178/0x3e0
  worker_thread+0x164/0x2e8
  kthread+0xfc/0x11c
  ret_from_fork+0x10/0x20
 Code: a8c27bfd d65f03c0 128002a0 d65f03c0 (f9414801)
 ---[ end trace 0000000000000000 ]---

Fix this by verifying that 'fuse->dev' is valid before passing to
dev_fwnode().

Fixes: c5b2d43e67bb ("soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Kartik <kkartik@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2024-02-01 15:58:20 +01:00
..
amlogic pmdomain: amlogic: Move Kconfig options to the pmdomain subsystem 2023-09-20 10:08:45 +02:00
apple soc: apple: mailbox: Add explicit include of platform_device.h 2023-11-23 19:10:47 +09:00
aspeed soc/aspeed: Convert to platform remove callback returning void 2023-10-13 15:04:12 +10:30
atmel soc: microchip: Explicitly include correct DT includes 2023-07-29 16:54:29 +03:00
bcm SoC driver updates for 6.7 2023-11-01 14:46:51 -10:00
canaan soc: canaan: Make K210_SYSCTL depend on CLK_K210 2023-03-15 14:22:53 +00:00
dove soc: dove: add missing of_node_put 2023-09-20 11:28:02 +02:00
fsl soc: fsl: cpm1: qmc: Introduce functions to change timeslots at runtime 2023-12-12 10:29:20 +01:00
fujitsu soc/fujitsu: a64fx-diag: Convert to platform remove callback returning void 2023-10-14 23:27:01 +02:00
gemini
hisilicon soc: hisilicon: kunpeng_hccs: Support the platform with PCC type3 and interrupt ack 2023-12-07 06:16:35 +00:00
imx - Move Kconfig files into the pmdomain subsystem 2023-11-01 13:09:46 -10:00
ixp4xx soc/ixp4xx: ixp4xx-qmgr: Convert to platform remove callback returning void 2023-10-14 23:27:13 +02:00
lantiq
litex soc/litex: litex_soc_ctrl: Convert to platform remove callback returning void 2023-10-14 23:27:17 +02:00
loongson Convert drivers/soc to struct platform_driver::remove_new() 2023-10-16 22:51:31 +02:00
mediatek soc: mediatek: mtk-svs: Constify runtime-immutable members of svs_bank 2023-12-11 11:36:15 +01:00
microchip soc: microchip: mpfs: add auto-update subdev to system controller 2023-12-06 12:06:18 +00:00
nuvoton soc: nuvoton: Add SoC info driver for WPCM450 2023-02-01 17:11:36 +01:00
pxa soc: pxa: ssp: fix casts 2024-01-09 08:25:29 +01:00
qcom drm-next for 6.8: 2024-01-12 11:32:19 -08:00
renesas soc: renesas: Make RZ/Five depend on !DMA_DIRECT_REMAP 2023-12-13 17:23:28 +01:00
rockchip SoC driver updates for 6.7 2023-11-01 14:46:51 -10:00
samsung soc: samsung: exynos-chipid: add exynosautov920 SoC support 2023-11-15 13:42:50 +01:00
sunxi pmdomain: sunxi: Move Kconfig option to the pmdomain subsystem 2023-10-04 23:41:56 +02:00
tegra soc/tegra: fuse: Fix crash in tegra_fuse_readl() 2024-02-01 15:58:20 +01:00
ti soc: ti: k3-socinfo: Add JTAG ID for J722S 2023-12-13 07:52:32 -06:00
ux500
versatile
xilinx Char/Misc and other Driver changes for 6.8-rc1 2024-01-17 16:47:17 -08:00
Kconfig soc: sifive: shunt ccache driver to drivers/cache 2023-11-22 11:49:25 +00:00
Makefile soc: sifive: shunt ccache driver to drivers/cache 2023-11-22 11:49:25 +00:00