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]
Message-ID: <YmLJEtDFhc3HFg3/@lahna>
Date:   Fri, 22 Apr 2022 18:26:10 +0300
From:   Mika Westerberg <mika.westerberg@...ux.intel.com>
To:     "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:     Linux ACPI <linux-acpi@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Bjorn Helgaas <helgaas@...nel.org>,
        Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] ACPI: bus: Avoid non-ACPI device objects in walks over
 children

Hi Rafael,

On Fri, Apr 22, 2022 at 05:13:48PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> When walking the children of an ACPI device, take extra care to avoid
> using to_acpi_device() on the ones that are not ACPI devices, because
> that may lead to out-of-bounds access and memory corruption.
> 
> While at it, make the function passed to acpi_dev_for_each_child()
> take a struct acpi_device pointer argument (instead of a struct device
> one), so it is more straightforward to use.
> 
> Fixes: b7dd6298db81 ("ACPI: PM: Introduce acpi_dev_power_up_children_with_adr()")
> Reported-by: kernel test robot <oliver.sang@...el.com>
> BugLink: https://lore.kernel.org/lkml/20220420064725.GB16310@xsang-OptiPlex-9020/
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> 
> The commit being fixed is present in linux-next.
> 
> ---
>  drivers/acpi/bus.c       |   24 ++++++++++++++++++++++--
>  drivers/acpi/device_pm.c |    5 +----
>  include/acpi/acpi_bus.h  |    2 +-
>  3 files changed, 24 insertions(+), 7 deletions(-)
> 
> Index: linux-pm/drivers/acpi/bus.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/bus.c
> +++ linux-pm/drivers/acpi/bus.c
> @@ -1070,10 +1070,30 @@ int acpi_bus_for_each_dev(int (*fn)(stru
>  }
>  EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);
>  
> +struct acpi_dev_walk_context {
> +	int (*fn)(struct acpi_device *, void *);
> +	void *data;
> +};
> +
> +static int acpi_dev_for_one_check(struct device *dev, void *context)
> +{
> +	struct acpi_dev_walk_context *adwc = context;
> +
> +	if (dev->bus != &acpi_bus_type)
> +		return 0;

I wonder if it make sense to add dev_is_acpi() that does the above
analoguos to dev_is_pci()?

Regardless of that,

Reviewed-by: Mika Westerberg <mika.westerberg@...ux.intel.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ