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-next>] [day] [month] [year] [list]
Message-Id: <20230126112129.4602-1-johan+linaro@kernel.org>
Date:   Thu, 26 Jan 2023 12:21:29 +0100
From:   Johan Hovold <johan+linaro@...nel.org>
To:     Ard Biesheuvel <ardb@...nel.org>
Cc:     Jeremy Kerr <jk@...abs.org>,
        Maximilian Luz <luzmaximilian@...il.com>,
        linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Johan Hovold <johan+linaro@...nel.org>,
        Steev Klimaszewski <steev@...i.org>
Subject: [PATCH] efivarfs: fix NULL-deref on mount when no efivars

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>
---
 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ