Messages in this thread | | | From | Ard Biesheuvel <> | Date | Thu, 26 Jan 2023 21:32:27 +0100 | Subject | Re: [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 >
| |