* [PATCH v2 1/5] efi/dev-path-parser: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:30 [PATCH v2 0/5] ACPI: Replace acpi_get_first_physical_node() with acpi_bus_get_primary_device() Rafael J. Wysocki
@ 2026-09-30 18:41 ` Rafael J. Wysocki
2026-09-30 18:42 ` [PATCH v2 3/5] ALSA: hda: cs35l41: " Rafael J. Wysocki
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2026-09-30 18:41 UTC (permalink / raw)
To: Linux ACPI, linux-efi
Cc: LKML, Andy Shevchenko, Sudeep Holla, linux-arm-kernel,
Ard Biesheuvel, Ilias Apalodimas, Will Deacon, Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, iommu, David Rhodes,
Richard Fitzgerald, linux-sound, patches, Shenghao Ding,
Kevin Lu, Baojun Xu, Sen Wang
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Replace acpi_get_first_physical_node() that is slated for removal
with acpi_bus_get_primary_device() that takes a reference to the
device it is about to return.
This addresses a potential use-after-free that may occur if the
device returned by acpi_get_first_physical_node() is removed right
after dropping its ACPI companion's physical_node_lock in that
function.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
This patch depends on new material in linux-next.
If you maintain the code updated by it, please consider ACKing it, so I can
pick it up and remove the problematic API replaced by it during the 7.4
merge window.
In the absence of feedback, it will be resent again when 7.4-rc1 is out.
Thanks!
v1 -> v2: No changes
---
drivers/firmware/efi/dev-path-parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c
index 13ea141c0def..e0f864cbaa8c 100644
--- a/drivers/firmware/efi/dev-path-parser.c
+++ b/drivers/firmware/efi/dev-path-parser.c
@@ -37,9 +37,9 @@ static long __init parse_acpi_path(const struct efi_dev_path *node,
if (!adev)
return -ENODEV;
- phys_dev = acpi_get_first_physical_node(adev);
+ phys_dev = acpi_bus_get_primary_device(adev);
if (phys_dev) {
- *child = get_device(phys_dev);
+ *child = phys_dev;
acpi_dev_put(adev);
} else
*child = &adev->dev;
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v2 3/5] ALSA: hda: cs35l41: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:30 [PATCH v2 0/5] ACPI: Replace acpi_get_first_physical_node() with acpi_bus_get_primary_device() Rafael J. Wysocki
2026-09-30 18:41 ` [PATCH v2 1/5] efi/dev-path-parser: Switch to use acpi_bus_get_primary_device() Rafael J. Wysocki
@ 2026-09-30 18:42 ` Rafael J. Wysocki
2026-10-01 6:21 ` Takashi Iwai
2026-09-30 18:42 ` [PATCH v2 4/5] ALSA: hda: tas2781: " Rafael J. Wysocki
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Rafael J. Wysocki @ 2026-09-30 18:42 UTC (permalink / raw)
To: Linux ACPI, linux-sound
Cc: LKML, Andy Shevchenko, Sudeep Holla, linux-arm-kernel,
Ard Biesheuvel, Ilias Apalodimas, linux-efi, Will Deacon,
Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, iommu, David Rhodes,
Richard Fitzgerald, patches, Shenghao Ding, Kevin Lu, Baojun Xu,
Sen Wang
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Replace acpi_get_first_physical_node() that is slated for removal
with acpi_bus_get_primary_device() that takes a reference to the
device it is about to return.
This addresses a potential use-after-free that may occur if the
device returned by acpi_get_first_physical_node() is removed right
after dropping its ACPI companion's physical_node_lock in that
function.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
This patch depends on new material in linux-next.
If you maintain the code updated by it, please consider ACKing it, so I can
pick it up and remove the problematic API replaced by it during the 7.4
merge window.
In the absence of feedback, it will be resent again when 7.4-rc1 is out.
Thanks!
v1 -> v2: No changes
---
sound/hda/codecs/side-codecs/cs35l41_hda.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c
index 62296be45c55..32abb71dd401 100644
--- a/sound/hda/codecs/side-codecs/cs35l41_hda.c
+++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c
@@ -1926,8 +1926,7 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
}
cs35l41->dacpi = adev;
- struct device *physdev __free(put_device) =
- get_device(acpi_get_first_physical_node(adev));
+ struct device *physdev __free(put_device) = acpi_bus_get_primary_device(adev);
if (!physdev) {
acpi_dev_put(adev);
return -ENODEV;
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2 3/5] ALSA: hda: cs35l41: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:42 ` [PATCH v2 3/5] ALSA: hda: cs35l41: " Rafael J. Wysocki
@ 2026-10-01 6:21 ` Takashi Iwai
0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2026-10-01 6:21 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux ACPI, linux-sound, LKML, Andy Shevchenko, Sudeep Holla,
linux-arm-kernel, Ard Biesheuvel, Ilias Apalodimas, linux-efi,
Will Deacon, Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, iommu, David Rhodes,
Richard Fitzgerald, patches, Shenghao Ding, Kevin Lu, Baojun Xu,
Sen Wang
On Wed, 30 Sep 2026 20:42:15 +0200,
Rafael J. Wysocki wrote:
>
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Replace acpi_get_first_physical_node() that is slated for removal
> with acpi_bus_get_primary_device() that takes a reference to the
> device it is about to return.
>
> This addresses a potential use-after-free that may occur if the
> device returned by acpi_get_first_physical_node() is removed right
> after dropping its ACPI companion's physical_node_lock in that
> function.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> This patch depends on new material in linux-next.
>
> If you maintain the code updated by it, please consider ACKing it, so I can
> pick it up and remove the problematic API replaced by it during the 7.4
> merge window.
>
> In the absence of feedback, it will be resent again when 7.4-rc1 is out.
>
> Thanks!
Acked-by: Takashi Iwai <tiwai@suse.de>
thanks,
Takashi
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 4/5] ALSA: hda: tas2781: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:30 [PATCH v2 0/5] ACPI: Replace acpi_get_first_physical_node() with acpi_bus_get_primary_device() Rafael J. Wysocki
2026-09-30 18:41 ` [PATCH v2 1/5] efi/dev-path-parser: Switch to use acpi_bus_get_primary_device() Rafael J. Wysocki
2026-09-30 18:42 ` [PATCH v2 3/5] ALSA: hda: cs35l41: " Rafael J. Wysocki
@ 2026-09-30 18:42 ` Rafael J. Wysocki
2026-10-01 6:21 ` Takashi Iwai
2026-09-30 18:43 ` [PATCH v2 2/5] iommu/arm-smmu-v3: " Rafael J. Wysocki
2026-09-30 18:45 ` [PATCH v2 5/5] ACPI: bus: Drop acpi_get_first_physical_node() Rafael J. Wysocki
4 siblings, 1 reply; 9+ messages in thread
From: Rafael J. Wysocki @ 2026-09-30 18:42 UTC (permalink / raw)
To: Linux ACPI, linux-sound
Cc: LKML, Andy Shevchenko, Sudeep Holla, linux-arm-kernel,
Ard Biesheuvel, Ilias Apalodimas, linux-efi, Will Deacon,
Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, iommu, David Rhodes,
Richard Fitzgerald, patches, Shenghao Ding, Kevin Lu, Baojun Xu,
Sen Wang
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Replace acpi_get_first_physical_node() that is slated for removal
with acpi_bus_get_primary_device() that takes a reference to the
device it is about to return.
This addresses a potential use-after-free that may occur if the
device returned by acpi_get_first_physical_node() is removed right
after dropping its ACPI companion's physical_node_lock in that
function.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
This patch depends on new material in linux-next.
If you maintain the code updated by it, please consider ACKing it, so I can
pick it up and remove the problematic API replaced by it during the 7.4
merge window.
In the absence of feedback, it will be resent again when 7.4-rc1 is out.
Thanks!
v1 -> v2: No changes
---
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c | 3 +--
sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
index 5e5f46c9fb6b..161ca965c63e 100644
--- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
+++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
@@ -100,8 +100,7 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid)
return -ENODEV;
}
- struct device *physdev __free(put_device) =
- get_device(acpi_get_first_physical_node(adev));
+ struct device *physdev __free(put_device) = acpi_bus_get_primary_device(adev);
ret = acpi_dev_get_resources(adev, &resources, tas2781_get_i2c_res, p);
if (ret < 0) {
dev_err(p->dev, "Failed to get ACPI resource.\n");
diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c
index da71b57a26ee..f3ba7132d2b8 100644
--- a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c
+++ b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c
@@ -341,8 +341,7 @@ static int tas2781_read_acpi(struct tas2781_hda *tas_hda,
strscpy(p->dev_name, hid, sizeof(p->dev_name));
- struct device *physdev __free(put_device) =
- get_device(acpi_get_first_physical_node(adev));
+ struct device *physdev __free(put_device) = acpi_bus_get_primary_device(adev);
acpi_dev_put(adev);
if (!physdev)
return -ENODEV;
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2 4/5] ALSA: hda: tas2781: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:42 ` [PATCH v2 4/5] ALSA: hda: tas2781: " Rafael J. Wysocki
@ 2026-10-01 6:21 ` Takashi Iwai
0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2026-10-01 6:21 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux ACPI, linux-sound, LKML, Andy Shevchenko, Sudeep Holla,
linux-arm-kernel, Ard Biesheuvel, Ilias Apalodimas, linux-efi,
Will Deacon, Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, iommu, David Rhodes,
Richard Fitzgerald, patches, Shenghao Ding, Kevin Lu, Baojun Xu,
Sen Wang
On Wed, 30 Sep 2026 20:42:36 +0200,
Rafael J. Wysocki wrote:
>
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Replace acpi_get_first_physical_node() that is slated for removal
> with acpi_bus_get_primary_device() that takes a reference to the
> device it is about to return.
>
> This addresses a potential use-after-free that may occur if the
> device returned by acpi_get_first_physical_node() is removed right
> after dropping its ACPI companion's physical_node_lock in that
> function.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> This patch depends on new material in linux-next.
>
> If you maintain the code updated by it, please consider ACKing it, so I can
> pick it up and remove the problematic API replaced by it during the 7.4
> merge window.
>
> In the absence of feedback, it will be resent again when 7.4-rc1 is out.
>
> Thanks!
Acked-by: Takashi Iwai <tiwai@suse.de>
thanks,
Takashi
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/5] iommu/arm-smmu-v3: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:30 [PATCH v2 0/5] ACPI: Replace acpi_get_first_physical_node() with acpi_bus_get_primary_device() Rafael J. Wysocki
` (2 preceding siblings ...)
2026-09-30 18:42 ` [PATCH v2 4/5] ALSA: hda: tas2781: " Rafael J. Wysocki
@ 2026-09-30 18:43 ` Rafael J. Wysocki
2026-09-30 21:53 ` Nicolin Chen
2026-09-30 18:45 ` [PATCH v2 5/5] ACPI: bus: Drop acpi_get_first_physical_node() Rafael J. Wysocki
4 siblings, 1 reply; 9+ messages in thread
From: Rafael J. Wysocki @ 2026-09-30 18:43 UTC (permalink / raw)
To: Linux ACPI, iommu
Cc: linux-arm-kernel, LKML, Andy Shevchenko, Sudeep Holla,
Ard Biesheuvel, Ilias Apalodimas, linux-efi, Will Deacon,
Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, David Rhodes,
Richard Fitzgerald, linux-sound, patches, Shenghao Ding,
Kevin Lu, Baojun Xu, Sen Wang
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Replace acpi_get_first_physical_node() that is slated for removal
with acpi_bus_get_primary_device() that takes a reference to the
device it is about to return.
This addresses a potential use-after-free that may occur if the
device returned by acpi_get_first_physical_node() is removed right
after dropping its ACPI companion's physical_node_lock in that
function.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
This patch depends on new material in linux-next.
If you maintain the code updated by it, please consider ACKing it, so I can
pick it up and remove the problematic API replaced by it during the 7.4
merge window.
In the absence of feedback, it will be resent again when 7.4-rc1 is out.
Thanks!
v1 -> v2: No changes
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 5732f3ba0122..98f105798b89 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -5307,7 +5307,7 @@ static void acpi_smmu_dsdt_probe_tegra241_cmdqv(struct acpi_iort_node *node,
adev = acpi_dev_get_first_match_dev("NVDA200C", uid, -1);
if (adev) {
/* Tegra241 CMDQV driver is responsible for put_device() */
- smmu->impl_dev = get_device(acpi_get_first_physical_node(adev));
+ smmu->impl_dev = acpi_bus_get_primary_device(adev);
smmu->options |= ARM_SMMU_OPT_TEGRA241_CMDQV;
dev_info(smmu->dev, "found companion CMDQV device: %s\n",
dev_name(smmu->impl_dev));
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/5] iommu/arm-smmu-v3: Switch to use acpi_bus_get_primary_device()
2026-09-30 18:43 ` [PATCH v2 2/5] iommu/arm-smmu-v3: " Rafael J. Wysocki
@ 2026-09-30 21:53 ` Nicolin Chen
0 siblings, 0 replies; 9+ messages in thread
From: Nicolin Chen @ 2026-09-30 21:53 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux ACPI, iommu, linux-arm-kernel, LKML, Andy Shevchenko,
Sudeep Holla, Ard Biesheuvel, Ilias Apalodimas, linux-efi,
Will Deacon, Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, David Rhodes,
Richard Fitzgerald, linux-sound, patches, Shenghao Ding,
Kevin Lu, Baojun Xu, Sen Wang
On Wed, Sep 30, 2026 at 08:43:03PM +0200, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Replace acpi_get_first_physical_node() that is slated for removal
> with acpi_bus_get_primary_device() that takes a reference to the
> device it is about to return.
>
> This addresses a potential use-after-free that may occur if the
> device returned by acpi_get_first_physical_node() is removed right
> after dropping its ACPI companion's physical_node_lock in that
> function.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 5/5] ACPI: bus: Drop acpi_get_first_physical_node()
2026-09-30 18:30 [PATCH v2 0/5] ACPI: Replace acpi_get_first_physical_node() with acpi_bus_get_primary_device() Rafael J. Wysocki
` (3 preceding siblings ...)
2026-09-30 18:43 ` [PATCH v2 2/5] iommu/arm-smmu-v3: " Rafael J. Wysocki
@ 2026-09-30 18:45 ` Rafael J. Wysocki
4 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2026-09-30 18:45 UTC (permalink / raw)
To: Linux ACPI
Cc: LKML, Andy Shevchenko, Sudeep Holla, linux-arm-kernel,
Ard Biesheuvel, Ilias Apalodimas, linux-efi, Will Deacon,
Joerg Roedel (AMD),
Jaroslav Kysela, Takashi Iwai, Robin Murphy, iommu, David Rhodes,
Richard Fitzgerald, linux-sound, patches, Shenghao Ding,
Kevin Lu, Baojun Xu, Sen Wang
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Fold acpi_get_first_physical_node() into acpi_primary_dev_companion()
that is its only remaining caller and drop its signature from the
header file.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
---
v1 -> v2:
* Add R-by from Sudeep
---
drivers/acpi/bus.c | 20 +++++---------------
include/linux/acpi.h | 7 -------
2 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 808c6746be14..cc6989d88645 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -809,24 +809,14 @@ struct device *acpi_bus_get_primary_device(struct acpi_device *adev)
}
EXPORT_SYMBOL_GPL(acpi_bus_get_primary_device);
-/**
- * acpi_get_first_physical_node - Find first physical node of an ACPI device
- * @adev: ACPI device in question
- *
- * Return: First physical node of ACPI device @adev
- */
-struct device *acpi_get_first_physical_node(struct acpi_device *adev)
-{
- guard(mutex)(&adev->physical_node_lock);
-
- return primary_physical_device(adev);
-}
-EXPORT_SYMBOL_GPL(acpi_get_first_physical_node);
-
static struct acpi_device *acpi_primary_dev_companion(struct acpi_device *adev,
const struct device *dev)
{
- const struct device *phys_dev = acpi_get_first_physical_node(adev);
+ const struct device *phys_dev;
+
+ guard(mutex)(&adev->physical_node_lock);
+
+ phys_dev = primary_physical_device(adev);
return phys_dev && phys_dev == dev ? adev : NULL;
}
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ba5234bd93a2..6f69819f9c9a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -105,8 +105,6 @@ static inline const char *acpi_dev_name(struct acpi_device *adev)
return dev_name(&adev->dev);
}
-struct device *acpi_get_first_physical_node(struct acpi_device *adev);
-
enum acpi_irq_model_id {
ACPI_IRQ_MODEL_PIC = 0,
ACPI_IRQ_MODEL_IOAPIC,
@@ -938,11 +936,6 @@ static inline const char *acpi_dev_name(struct acpi_device *adev)
return NULL;
}
-static inline struct device *acpi_get_first_physical_node(struct acpi_device *adev)
-{
- return NULL;
-}
-
static inline void acpi_early_init(void) { }
static inline void acpi_subsystem_init(void) { }
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread