[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXEUKChvqA8D_T3Bt-pQhvjBmsGxyy69uqDqyn0EBmQ1pw@mail.gmail.com>
Date: Thu, 26 Jan 2023 21:32:27 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: Johan Hovold <johan+linaro@...nel.org>
Cc: Jeremy Kerr <jk@...abs.org>,
Maximilian Luz <luzmaximilian@...il.com>,
linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
Steev Klimaszewski <steev@...i.org>
Subject: Re: [PATCH] efivarfs: fix NULL-deref on mount when no efivars
On Thu, 26 Jan 2023 at 12:23, Johan Hovold <johan+linaro@...nel.org> wrote:
>
> The VFS calls kill_sb() also in case mount fails in get_tree().
>
> Add the missing check to make sure that efivars has been registered also
> to kill_sb() to avoid dereferencing a NULL pointer when trying to remove
> efivar entries.
>
> Fixes: c3fd71b428b8 ("efivarfs: always register filesystem")
> Reported-by: Steev Klimaszewski <steev@...i.org>
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
Thanks - I have squashed this with the original patch.
> ---
> fs/efivarfs/super.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
> index b67d431c861a..482d612b716b 100644
> --- a/fs/efivarfs/super.c
> +++ b/fs/efivarfs/super.c
> @@ -246,6 +246,9 @@ static void efivarfs_kill_sb(struct super_block *sb)
> {
> kill_litter_super(sb);
>
> + if (!efivar_is_available())
> + return;
> +
> /* Remove all entries and destroy */
> efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL);
> }
> --
> 2.39.1
>
Powered by blists - more mailing lists