[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0h8GhHDguSuO2v05k15uQyYvNqUpO=Ott=t8-QdoueW4g@mail.gmail.com>
Date: Tue, 21 Nov 2023 20:49:26 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Nikita Kiryushin <kiryushin@...ud.ru>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Matthew Garrett <mjg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: Re: [PATCH] ACPI: video: check for error while searching for backlit
device parent
On Thu, Nov 9, 2023 at 2:49 PM Nikita Kiryushin <kiryushin@...ud.ru> wrote:
>
> If acpi_get_parent called in acpi_video_dev_register_backlight fails
> (for example, acpi_ut_acquire_mutex fails inside acpi_get_parent),
> this can lead to incorrect (uninitialized) acpi_parent handler being
> passed to acpi_get_pci_dev for detecting parent pci device.
>
> Check acpi_get_parent result and set parent device only in case of success.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 9661e92c10a9 ("acpi: tie ACPI backlight devices to PCI devices if
> possible")
> Signed-off-by: Nikita Kiryushin <kiryushin@...ud.ru>
> ---
> drivers/acpi/acpi_video.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
> index 0b7a01f38b65..1d550887349a 100644
> --- a/drivers/acpi/acpi_video.c
> +++ b/drivers/acpi/acpi_video.c
> @@ -1717,12 +1717,12 @@ static void
> acpi_video_dev_register_backlight(struct acpi_video_device *device)
> return;
> count++;
> - acpi_get_parent(device->dev->handle, &acpi_parent);
> -
> - pdev = acpi_get_pci_dev(acpi_parent);
> - if (pdev) {
> - parent = &pdev->dev;
> - pci_dev_put(pdev);
> + if (ACPI_SUCCESS(acpi_get_parent(device->dev->handle, &acpi_parent))) {
> + pdev = acpi_get_pci_dev(acpi_parent);
> + if (pdev) {
> + parent = &pdev->dev;
> + pci_dev_put(pdev);
> + }
> }
> memset(&props, 0, sizeof(struct backlight_properties));
> --
Applied as 6.8 material with some minor adjustments in the subject and
changeolog, but please note that your mailer garbles the patch context
lines.
Thanks!
Powered by blists - more mailing lists