linux-brain/drivers/of
Marc Zyngier a73bbfabfe of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS
[ Upstream commit 6211e9cb2f8faf7faae0b6caf844bfe9527cc607 ]

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-22 12:26:34 +02:00
..
unittest-data of: overlay: check prevents multiple fragments touching same property 2018-11-08 22:12:03 -08:00
address.c of/address: Fix of_node memory leak in of_dma_is_coherent 2020-11-18 19:20:28 +01:00
base.c of: restore old handling of cells_name=NULL in of_*_phandle_with_args() 2019-09-19 08:33:02 -05:00
device.c of/device.c: fix the wrong comments 2019-05-01 13:41:07 -05:00
dynamic.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
fdt.c of: Fix truncation of memory sizes on 32-bit platforms 2021-07-14 16:53:45 +02:00
irq.c of: irq: fix a trivial typo in a doc comment 2019-08-14 20:12:16 -06:00
Kconfig of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc 2020-02-11 04:35:25 -08:00
kobj.c of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS 2021-09-22 12:26:34 +02:00
Makefile PCI: Move OF-related PCI functions into PCI core 2018-01-17 17:36:39 -06:00
of_mdio.c of: of_mdio: Correct loop scanning logic 2020-07-22 09:32:55 +02:00
of_net.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
of_numa.c of, numa: Validate some distance map rules 2018-11-08 12:44:34 -06:00
of_private.h of: __of_detach_node() - remove node from phandle cache 2018-12-21 12:42:36 -06:00
of_reserved_mem.c of: Fix truncation of memory sizes on 32-bit platforms 2021-07-14 16:53:45 +02:00
overlay.c of: overlay: kmemleak in dup_and_fixup_symbol_prop() 2020-04-23 10:36:23 +02:00
pdt.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
platform.c drivers: Introduce device lookup variants by of_node 2019-07-30 13:07:41 +02:00
property.c of: property: Document that of_graph_get_endpoint_by_regs needs of_node_put 2019-04-10 09:03:03 -05:00
resolver.c of: resolver: Add of_node_put() before return and break 2019-08-12 16:52:24 -06:00
unittest.c of: unittest: kmemleak in of_unittest_overlay_high_level() 2020-04-23 10:36:23 +02:00