lkml.org 
[lkml]   [2023]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] efivarfs: fix NULL-deref on mount when no efivars
On Thu, 26 Jan 2023 at 12:23, Johan Hovold <johan+linaro@kernel.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@kali.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.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
>

\
 
 \ /
  Last update: 2023-03-26 23:57    [W:0.094 / U:1.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site