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: <CAJZ5v0jXjmgV8vAVgJzVfmPKFXOPbeXYojxOnqKQu4wukFSt-A@mail.gmail.com>
Date:   Sat, 10 Sep 2022 18:17:17 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Li Zhong <floridsleeves@...il.com>
Cc:     ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1] drivers/acpi/acpi_video: check return value of acpi_get_parent()

On Fri, Sep 2, 2022 at 9:42 AM Li Zhong <floridsleeves@...il.com> wrote:
>
> Check return status of acpi_get_parent() to confirm whether it fails.
>
> Signed-off-by: Li Zhong <floridsleeves@...il.com>
> ---
>  drivers/acpi/acpi_video.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
> index 5cbe2196176d..5fca9a39b1a4 100644
> --- a/drivers/acpi/acpi_video.c
> +++ b/drivers/acpi/acpi_video.c
> @@ -1,4 +1,4 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> +       // SPDX-License-Identifier: GPL-2.0-or-later

This change surely is not intended?

>  /*
>   *  video.c - ACPI Video Driver
>   *
> @@ -1753,6 +1753,7 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
>         int result;
>         static int count;
>         char *name;
> +       acpi_status status;
>
>         result = acpi_video_init_brightness(device);
>         if (result)
> @@ -1766,8 +1767,9 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
>                 return;
>         count++;
>
> -       acpi_get_parent(device->dev->handle, &acpi_parent);
> -
> +       status = acpi_get_parent(device->dev->handle, &acpi_parent);
> +       if (ACPI_FAILURE(status))
> +               return;

But device->dev->handle is known to be valid, so the only case in
which acpi_get_parent() above can fail is when the given namespace
object has no parent, in which case acpi_parent will be NULL, so that
should be caught my the check below, shouldn't it?

>         pdev = acpi_get_pci_dev(acpi_parent);
>         if (pdev) {
>                 parent = &pdev->dev;
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ