lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250611225642.266069-1-pratap.nirujogi@amd.com>
Date: Wed, 11 Jun 2025 18:56:14 -0400
From: Pratap Nirujogi <pratap.nirujogi@....com>
To: <lee@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <benjamin.chan@....com>, <bin.du@....com>,
	<grosikop@....com>, <king.li@....com>, <dantony@....com>,
	<phil.jawich@....com>, Pratap Nirujogi <pratap.nirujogi@....com>
Subject: [PATCH] mfd: core: Fix MFD swnode and fwnode conflict

Initializing the MFD child device's fwnode with the parent
or matching ACPI device's fwnode is causing conflict when
software_node (mfd_cell->swnode) is explicitly assigned during
device creation.

Since a device is not expected to have both fwnode and swnode,
this conflict is leading to mfd_add_hotplug_devices() failure.

To fix this issue, skip initializing the fwnode from the parent
or matching ACPI device when a swnode is already present for the
MFD child.

Signed-off-by: Pratap Nirujogi <pratap.nirujogi@....com>
---
 drivers/mfd/mfd-core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 76bd316a50af..d5680132ed21 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -212,17 +212,17 @@ static int mfd_add_device(struct device *parent, int id,
 				cell->name, platform_id);
 	}
 
-	mfd_acpi_add_device(cell, pdev);
-
-	if (cell->pdata_size) {
-		ret = platform_device_add_data(pdev,
-					cell->platform_data, cell->pdata_size);
+	if (cell->swnode) {
+		ret = device_add_software_node(&pdev->dev, cell->swnode);
 		if (ret)
 			goto fail_of_entry;
+	} else {
+		/* add parent dev fwnode only when swnode is not present */
+		mfd_acpi_add_device(cell, pdev);
 	}
 
-	if (cell->swnode) {
-		ret = device_add_software_node(&pdev->dev, cell->swnode);
+	if (cell->pdata_size) {
+		ret = platform_device_add_data(pdev, cell->platform_data, cell->pdata_size);
 		if (ret)
 			goto fail_of_entry;
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ