Unverified Commit 791f8e09 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4816 [sync] PR-4702: efivarfs: force RO when remounting if SetVariable is not supported

parents 13ec727f 6751653d
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <linux/ucs2_string.h>
#include <linux/slab.h>
#include <linux/magic.h>
#include <linux/printk.h>

#include "internal.h"

@@ -231,8 +232,19 @@ static int efivarfs_get_tree(struct fs_context *fc)
	return get_tree_single(fc, efivarfs_fill_super);
}

static int efivarfs_reconfigure(struct fs_context *fc)
{
	if (!efivar_supports_writes() && !(fc->sb_flags & SB_RDONLY)) {
		pr_err("Firmware does not support SetVariableRT. Can not remount with rw\n");
		return -EINVAL;
	}

	return 0;
}

static const struct fs_context_operations efivarfs_context_ops = {
	.get_tree	= efivarfs_get_tree,
	.reconfigure	= efivarfs_reconfigure,
};

static int efivarfs_init_fs_context(struct fs_context *fc)