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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 28 Apr 2024 04:17:39 +0000
From: "Zhang, Rui" <rui.zhang@...el.com>
To: "rjw@...ysocki.net" <rjw@...ysocki.net>, "linux-acpi@...r.kernel.org"
	<linux-acpi@...r.kernel.org>
CC: "salil.mehta@...wei.com" <salil.mehta@...wei.com>,
	"jonathan.cameron@...wei.com" <jonathan.cameron@...wei.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] ACPI: scan: Avoid enumerating devices with clearly
 invalid _STA values

On Fri, 2024-04-26 at 18:56 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> The return value of _STA with the "present" bit unset and the
> "enabled"
> bit set is clearly invalid as per the ACPI specification, Section
> 6.3.7
> "_STA (Device Status)", so make the ACPI device enumeration code
> disregard devices with such _STA return values.
> 
> Also, because this implies that status.enabled will only be set if
> status.present is set too, acpi_device_is_enabled() can be modified
> to simply return the value of the former.
> 
> Link:
> https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#sta-device-status
> Link:
> https://lore.kernel.org/linux-acpi/88179311a503493099028c12ca37d430@huawei.com/
> Suggested-by: Salil Mehta <salil.mehta@...wei.com>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>  drivers/acpi/bus.c  |   11 +++++++++++
>  drivers/acpi/scan.c |    2 +-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> Index: linux-pm/drivers/acpi/bus.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/bus.c
> +++ linux-pm/drivers/acpi/bus.c
> @@ -112,6 +112,17 @@ int acpi_bus_get_status(struct acpi_devi
>         if (ACPI_FAILURE(status))
>                 return -ENODEV;
>  
> +       if (!device->status.present && device->status.enabled) {
> +               pr_info(FW_BUG "Device [%s] status [%08x]: not
> present and enabled\n",
> +                       device->pnp.bus_id, (u32)sta);
> +               device->status.enabled = 0;
> +               /*
> +                * The status is clearly invalid, so clear the
> enabled bit as
> +                * well to avoid attempting to use the device.
> +                */

seems that this comment is for the line above?

thanks,
rui
> +               device->status.functional = 0;
> +       }
> +
>         acpi_set_device_status(device, sta);
>  
>         if (device->status.functional && !device->status.present) {
> Index: linux-pm/drivers/acpi/scan.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/scan.c
> +++ linux-pm/drivers/acpi/scan.c
> @@ -1962,7 +1962,7 @@ bool acpi_device_is_present(const struct
>  
>  bool acpi_device_is_enabled(const struct acpi_device *adev)
>  {
> -       return adev->status.present && adev->status.enabled;
> +       return adev->status.enabled;
>  }
>  
>  static bool acpi_scan_handler_matching(struct acpi_scan_handler
> *handler,
> 
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ