[PATCH] efivarfs: fix NULL-deref on mount when no efivars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
Signed-off-by: Johan Hovold <johan+linaro@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux