Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b6e75ee authored by Oleg Drokin's avatar Oleg Drokin Committed by Rafael J. Wysocki
Browse files

ACPI / EC: Deny write access unless requested by module param



In debugfs it's not enough to just set file mode to read-only to
deny write access to a file, instead just don't provide
the write method unless write access is really requested.

Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Acked-by: default avatarThomas Renninger <trenn@suse.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent f6cede5b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
	loff_t init_off = *off;
	loff_t init_off = *off;
	int err = 0;
	int err = 0;


	if (!write_support)
		return -EINVAL;

	if (*off >= EC_SPACE_SIZE)
	if (*off >= EC_SPACE_SIZE)
		return 0;
		return 0;
	if (*off + count >= EC_SPACE_SIZE) {
	if (*off + count >= EC_SPACE_SIZE) {