# Re: \[PATCH\] of: Don't allow \_\_of\_attached\_node\_sysfs() without CONFIG\_SYSFS

- From: Rob Herring \<robh@kernel.org\>
- Date: 2021-08-23 18:47:05 
- List: linux-devicetree
- Page: https://ratatoskr.run/linux-devicetree/2021/08/1486145
- Thread: https://ratatoskr.run/linux-devicetree/2021/08/1484044/t.md

```text
On Sun, Aug 22, 2021 at 11:01:15PM -0500, Frank Rowand wrote:
> Hi Marc,
> 
> On 8/20/21 9:47 AM, Marc Zyngier wrote:
> > 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.
> 
> CONFIG_SYSFS should be automatically selected when CONFIG_OF_DYNAMIC
> is enabled, and it should not be possible to disable CONFIG_SYSFS
> in this case.

That used to be true, but isn't now.

Rob
```
