* [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources()
@ 2026-11-10 5:34 lirongqing
2026-11-10 5:41 ` sashiko-bot
2026-11-10 11:33 ` Rafael J. Wysocki (Intel)
0 siblings, 2 replies; 4+ messages in thread
From: lirongqing @ 2026-11-10 5:34 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Bjorn Helgaas, linux-acpi,
linux-pci, linux-kernel
Cc: Li RongQing
From: Li RongQing <lirongqing@baidu.com>
acpi_get_devices() returns AE_OK even when the namespace walk finishes
without a match, in which case the return_value argument is not written.
The caller passes an uninitialized acpi_handle and hands it to
acpi_fetch_acpi_dev(), which dereferences it as an ACPI node.
Initialize the handle and reject a missing match.
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
drivers/pci/pci-acpi.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index e260089..e90e749 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -82,7 +82,7 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
{
struct acpi_device *adev;
acpi_status status;
- acpi_handle handle;
+ acpi_handle handle = NULL;
int ret;
status = acpi_get_devices(hid, acpi_match_rc, &segment, &handle);
@@ -92,6 +92,9 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
return -ENODEV;
}
+ if (!handle)
+ return -ENODEV;
+
adev = acpi_fetch_acpi_dev(handle);
if (!adev)
return -ENODEV;
--
2.9.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources()
2026-11-10 5:34 [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources() lirongqing
@ 2026-11-10 5:41 ` sashiko-bot
2026-11-10 8:11 ` 答复: [外部邮件] " Li,Rongqing
2026-11-10 11:33 ` Rafael J. Wysocki (Intel)
1 sibling, 1 reply; 4+ messages in thread
From: sashiko-bot @ 2026-11-10 5:41 UTC (permalink / raw)
To: lirongqing, linux-pci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] PCI/ACPI: missing Fixes trailer for acpi_get_rc_resources() fix
--
commit 2dd263c8741dc2f24a59dc48d0def98c31872ce2
Author: Li RongQing <lirongqing@baidu.com>
> PCI/ACPI: Check the found handle in acpi_get_rc_resources()
>
> acpi_get_devices() returns AE_OK even when the namespace walk finishes
> without a match, in which case the return_value argument is not written.
> The caller passes an uninitialized acpi_handle and hands it to
> acpi_fetch_acpi_dev(), which dereferences it as an ACPI node.
>
> Initialize the handle and reject a missing match.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
[Severity: Low]
Since this fixes an uninitialized handle dereference in
acpi_get_rc_resources() when acpi_get_devices() completes without a
match, please add a Fixes tag:
Fixes: 169de969c018 ("PCI/ACPI: Provide acpi_get_rc_resources() for ARM64 platform")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110053423.2517-1-lirongqing@baidu.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread* 答复: [外部邮件] Re: [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources()
2026-11-10 5:41 ` sashiko-bot
@ 2026-11-10 8:11 ` Li,Rongqing
0 siblings, 0 replies; 4+ messages in thread
From: Li,Rongqing @ 2026-11-10 8:11 UTC (permalink / raw)
To: sashiko-reviews@lists.linux.dev, linux-pci@vger.kernel.org
> -----邮件原件-----
> 发件人: sashiko-bot@kernel.org <sashiko-bot@kernel.org>
> 发送时间: 2026年11月10日 13:41
> 收件人: Li,Rongqing <lirongqing@baidu.com>; linux-pci@vger.kernel.org
> 主题: [外部邮件] Re: [PATCH] PCI/ACPI: Check the found handle in
> acpi_get_rc_resources()
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue to
> consider:
> - [Low] PCI/ACPI: missing Fixes trailer for acpi_get_rc_resources() fix
> --
>
> commit 2dd263c8741dc2f24a59dc48d0def98c31872ce2
> Author: Li RongQing <lirongqing@baidu.com>
>
> > PCI/ACPI: Check the found handle in acpi_get_rc_resources()
> >
> > acpi_get_devices() returns AE_OK even when the namespace walk finishes
> > without a match, in which case the return_value argument is not written.
> > The caller passes an uninitialized acpi_handle and hands it to
> > acpi_fetch_acpi_dev(), which dereferences it as an ACPI node.
> >
> > Initialize the handle and reject a missing match.
> >
> > Signed-off-by: Li RongQing <lirongqing@baidu.com>
>
> [Severity: Low]
> Since this fixes an uninitialized handle dereference in
> acpi_get_rc_resources() when acpi_get_devices() completes without a match,
> please add a Fixes tag:
>
> Fixes: 169de969c018 ("PCI/ACPI: Provide acpi_get_rc_resources() for ARM64
> platform")
>
I think this issue has limited impact, so I didn't add a Fixes tag. Please, maintainer, check whether a Fixes tag is needed when merging.
[Li,Rongqing]
> --
> Sashiko AI
> review · https://sashiko.dev/#/patchset/20261110053423.2517-1-lirongqing
> @baidu.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources()
2026-11-10 5:34 [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources() lirongqing
2026-11-10 5:41 ` sashiko-bot
@ 2026-11-10 11:33 ` Rafael J. Wysocki (Intel)
1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-11-10 11:33 UTC (permalink / raw)
To: lirongqing
Cc: Rafael J . Wysocki, Len Brown, Bjorn Helgaas, linux-acpi,
linux-pci, linux-kernel
On Tue, Nov 10, 2026 at 6:34 AM lirongqing <lirongqing@baidu.com> wrote:
>
> From: Li RongQing <lirongqing@baidu.com>
>
> acpi_get_devices() returns AE_OK even when the namespace walk finishes
> without a match, in which case the return_value argument is not written.
> The caller passes an uninitialized acpi_handle and hands it to
> acpi_fetch_acpi_dev(), which dereferences it as an ACPI node.
>
> Initialize the handle and reject a missing match.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
Stable may want to pick up this one, so please add a Fixes: tag as
suggested by Sashiko:
https://sashiko.dev/#/patchset/20261110053423.2517-1-lirongqing%40baidu.com
> ---
> drivers/pci/pci-acpi.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index e260089..e90e749 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -82,7 +82,7 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
> {
> struct acpi_device *adev;
> acpi_status status;
> - acpi_handle handle;
> + acpi_handle handle = NULL;
> int ret;
>
> status = acpi_get_devices(hid, acpi_match_rc, &segment, &handle);
> @@ -92,6 +92,9 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
> return -ENODEV;
> }
>
> + if (!handle)
> + return -ENODEV;
> +
> adev = acpi_fetch_acpi_dev(handle);
> if (!adev)
> return -ENODEV;
> --
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-10 11:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 5:34 [PATCH] PCI/ACPI: Check the found handle in acpi_get_rc_resources() lirongqing
2026-11-10 5:41 ` sashiko-bot
2026-11-10 8:11 ` 答复: [外部邮件] " Li,Rongqing
2026-11-10 11:33 ` Rafael J. Wysocki (Intel)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.