From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Marc Zyngier <maz@kernel.org>, Rob Herring <robh@kernel.org>,
Sasha Levin <sashal@kernel.org>,
devicetree@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 145/176] of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS
Date: Thu, 9 Sep 2021 07:50:47 -0400 [thread overview]
Message-ID: <20210909115118.146181-145-sashal@kernel.org> (raw)
In-Reply-To: <20210909115118.146181-1-sashal@kernel.org>
From: Marc Zyngier <maz@kernel.org>
[ 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>
---
drivers/of/kobj.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index a32e60b024b8..6675b5e56960 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -119,7 +119,7 @@ int __of_attach_node_sysfs(struct device_node *np)
struct property *pp;
int rc;
- if (!of_kset)
+ if (!IS_ENABLED(CONFIG_SYSFS) || !of_kset)
return 0;
np->kobj.kset = of_kset;
--
2.30.2
prev parent reply other threads:[~2021-09-09 12:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210909115118.146181-1-sashal@kernel.org>
2021-09-09 11:48 ` [PATCH AUTOSEL 5.10 014/176] ARM: dts: qcom: apq8064: correct clock names Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 045/176] arm64: dts: allwinner: h6: tanix-tx6: Fix regulator node names Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 064/176] ARM: dts: stm32: Set {bitclock,frame}-master phandles on DHCOM SoM Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 065/176] ARM: dts: stm32: Set {bitclock,frame}-master phandles on ST DKx Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 066/176] ARM: dts: stm32: Update AV96 adv7513 node per dtbs_check Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 068/176] ARM: dts: at91: use the right property for shutdown controller Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 069/176] arm64: tegra: Fix Tegra194 PCIe EP compatible string Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 079/176] arm64: dts: qcom: sdm630: Rewrite memory map Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 080/176] arm64: dts: qcom: sdm630: Fix TLMM node and pinctrl configuration Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 082/176] ARM: dts: imx53-ppd: Fix ACHC entry Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 083/176] arm64: dts: qcom: ipq8074: fix pci node reg property Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 084/176] arm64: dts: qcom: sdm660: use reg value for memory node Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 085/176] arm64: dts: qcom: ipq6018: drop '0x' from unit address Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 086/176] arm64: dts: qcom: sdm630: don't use underscore in node name Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 087/176] arm64: dts: qcom: msm8994: " Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 088/176] arm64: dts: qcom: msm8996: " Sasha Levin
2021-09-09 11:49 ` [PATCH AUTOSEL 5.10 089/176] arm64: dts: qcom: sm8250: Fix epss_l3 unit address Sasha Levin
2021-09-09 11:50 ` [PATCH AUTOSEL 5.10 108/176] ARM: tegra: acer-a500: Remove bogus USB VBUS regulators Sasha Levin
2021-09-09 11:50 ` [PATCH AUTOSEL 5.10 109/176] ARM: tegra: tamonten: Fix UART pad setting Sasha Levin
2021-09-09 11:50 ` [PATCH AUTOSEL 5.10 110/176] arm64: tegra: Fix compatible string for Tegra132 CPUs Sasha Levin
2021-09-09 11:50 ` [PATCH AUTOSEL 5.10 111/176] arm64: dts: ls1046a: fix eeprom entries Sasha Levin
2021-09-09 11:50 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210909115118.146181-145-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).