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] [day] [month] [year] [list]
Message-ID: <CAMj1kXHggvi9LRXKdEGWEs1xzOpD85H_S3CYQOX3byNaemSkZw@mail.gmail.com>
Date:   Fri, 23 Dec 2022 15:37:38 +0100
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Johan Hovold <johan+linaro@...nel.org>
Cc:     linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org, Li Heng <liheng40@...wei.com>
Subject: Re: [PATCH] efi: fix NULL-deref in init error path

On Mon, 19 Dec 2022 at 10:10, Johan Hovold <johan+linaro@...nel.org> wrote:
>
> In case runtime services are not supported or have been disabled the
> runtime services workqueue will never have been allocated.
>
> Do not try to destroy the workqueue unconditionally in the unlikely
> event that EFI initialisation fails to avoid dereferencing a NULL
> pointer.
>
> Fixes: 98086df8b70c ("efi: add missed destroy_workqueue when efisubsys_init fails")
> Cc: stable@...r.kernel.org
> Cc: Li Heng <liheng40@...wei.com>
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>

Thanks for the fix - I will queue it up after -rc1

> ---
>  drivers/firmware/efi/efi.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 09716eebe8ac..a2b0cbc8741c 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -394,8 +394,8 @@ static int __init efisubsys_init(void)
>         efi_kobj = kobject_create_and_add("efi", firmware_kobj);
>         if (!efi_kobj) {
>                 pr_err("efi: Firmware registration failed.\n");
> -               destroy_workqueue(efi_rts_wq);
> -               return -ENOMEM;
> +               error = -ENOMEM;
> +               goto err_destroy_wq;
>         }
>
>         if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE |
> @@ -443,7 +443,10 @@ static int __init efisubsys_init(void)
>  err_put:
>         kobject_put(efi_kobj);
>         efi_kobj = NULL;
> -       destroy_workqueue(efi_rts_wq);
> +err_destroy_wq:
> +       if (efi_rts_wq)
> +               destroy_workqueue(efi_rts_wq);
> +
>         return error;
>  }
>
> --
> 2.37.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ