linux-stable/drivers/of
Marc Zyngier 1a40e60e2a of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS
[ Upstream commit 6211e9cb2f ]

Trying to boot without SYSFS, but with OF_DYNAMIC quickly
results in a crash:

[    0.088460] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070
[...]
[    0.103927] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc3 #4179
[    0.105810] Hardware name: linux,dummy-virt (DT)
[    0.107147] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[    0.108876] pc : kernfs_find_and_get_ns+0x3c/0x7c
[    0.110244] lr : kernfs_find_and_get_ns+0x3c/0x7c
[...]
[    0.134087] Call trace:
[    0.134800]  kernfs_find_and_get_ns+0x3c/0x7c
[    0.136054]  safe_name+0x4c/0xd0
[    0.136994]  __of_attach_node_sysfs+0xf8/0x124
[    0.138287]  of_core_init+0x90/0xfc
[    0.139296]  driver_init+0x30/0x4c
[    0.140283]  kernel_init_freeable+0x160/0x1b8
[    0.141543]  kernel_init+0x30/0x140
[    0.142561]  ret_from_fork+0x10/0x18

While not having sysfs isn't a very common option these days,
it is still expected that such configuration would work.

Paper over it by bailing out from __of_attach_node_sysfs() if
CONFIG_SYSFS isn't enabled.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210820144722.169226-1-maz@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-18 13:40:31 +02:00
..
unittest-data of: unittest: Use bigger address cells to catch parser regressions 2020-08-03 16:24:49 -06:00
address.c of/address: Introduce of_dma_get_max_cpu_address() 2021-03-09 11:11:13 +01:00
base.c of: Export of_remove_property() to modules 2020-09-05 13:09:03 -07:00
device.c of/device: Update dma_range_map only when dev has valid dma-ranges 2021-02-03 23:28:50 +01:00
dynamic.c
fdt.c of: Fix truncation of memory sizes on 32-bit platforms 2021-07-14 16:56:46 +02:00
fdt_address.c
irq.c of/irq: Make of_msi_map_rid() PCI bus agnostic 2020-07-28 15:51:32 +01:00
Kconfig net: phy: Move of_mdio from drivers/of to drivers/net/mdio 2020-10-10 10:55:05 -07:00
kobj.c of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS 2021-09-18 13:40:31 +02:00
Makefile net: phy: Move of_mdio from drivers/of to drivers/net/mdio 2020-10-10 10:55:05 -07:00
of_net.c
of_numa.c
of_private.h dma-mapping: introduce DMA range map, supplanting dma_pfn_offset 2020-09-17 18:43:56 +02:00
of_reserved_mem.c of: Fix truncation of memory sizes on 32-bit platforms 2021-07-14 16:56:46 +02:00
overlay.c of: overlay: fix for_each_child.cocci warnings 2021-05-14 09:50:24 +02:00
pdt.c
platform.c of: platform: Destroy child devices symmetrically 2020-08-17 20:19:35 -06:00
property.c of: property: fw_devlink: do not link ".*,nr-gpios" 2021-04-14 08:41:58 +02:00
resolver.c
unittest.c of: unittest: Fix build on architectures without CONFIG_OF_ADDRESS 2021-03-09 11:11:15 +01:00