summaryrefslogtreecommitdiffstats
path: root/fs/efivarfs
diff options
context:
space:
mode:
authorJohan Hovold <johan+linaro@kernel.org>2023-01-19 17:42:53 +0100
committerArd Biesheuvel <ardb@kernel.org>2023-01-26 21:32:01 +0100
commit301de9a2055357375a4e1053d9df0f8f3467ff00 (patch)
tree06623cf2162f32d6008d6323d99886a2d5655036 /fs/efivarfs
parentbeeb107c5b354f4eaea17a9bca6ca8762f60effc (diff)
downloadlinux-301de9a2055357375a4e1053d9df0f8f3467ff00.tar.gz
linux-301de9a2055357375a4e1053d9df0f8f3467ff00.tar.bz2
linux-301de9a2055357375a4e1053d9df0f8f3467ff00.zip
efivarfs: always register filesystem
The efivar ops are typically registered at subsys init time so that they are available when efivarfs is registered at module init time. Other efivars implementations, such as Google SMI, exist and can currently be built as modules which means that efivar may not be available when efivarfs is initialised. Move the efivar availability check from module init to when the filesystem is mounted to allow late registration of efivars. Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'fs/efivarfs')
-rw-r--r--fs/efivarfs/super.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index f72c529c8ec3..482d612b716b 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -194,6 +194,9 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)
struct dentry *root;
int err;
+ if (!efivar_is_available())
+ return -EOPNOTSUPP;
+
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_blocksize = PAGE_SIZE;
sb->s_blocksize_bits = PAGE_SHIFT;
@@ -243,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);
}
@@ -256,9 +262,6 @@ static struct file_system_type efivarfs_type = {
static __init int efivarfs_init(void)
{
- if (!efivar_is_available())
- return -ENODEV;
-
return register_filesystem(&efivarfs_type);
}