[PATCH 2/2] efi: restrict top-level attribute permissions

From: Joe Konno
Date: Thu Feb 15 2018 - 13:23:15 EST


From: Joe Konno <joe.konno@xxxxxxxxx>

Restrict four top-level (/sys/firmware/efi) attributes to match systab.
This is for consistency's sake, as well as hygiene.

Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
Cc: linux-efi@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Joe Konno <joe.konno@xxxxxxxxx>
---
drivers/firmware/efi/efi.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index cd42f66a7c85..9a1f6c85c8c7 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -167,11 +167,13 @@ static ssize_t fw_platform_size_show(struct kobject *kobj,
return sprintf(buf, "%d\n", efi_enabled(EFI_64BIT) ? 64 : 32);
}

-static struct kobj_attribute efi_attr_fw_vendor = __ATTR_RO(fw_vendor);
-static struct kobj_attribute efi_attr_runtime = __ATTR_RO(runtime);
-static struct kobj_attribute efi_attr_config_table = __ATTR_RO(config_table);
+static struct kobj_attribute efi_attr_fw_vendor =
+ __ATTR_RO_MODE(fw_vendor, 0400);
+static struct kobj_attribute efi_attr_runtime = __ATTR_RO_MODE(runtime, 0400);
+static struct kobj_attribute efi_attr_config_table =
+ __ATTR_RO_MODE(config_table, 0400);
static struct kobj_attribute efi_attr_fw_platform_size =
- __ATTR_RO(fw_platform_size);
+ __ATTR_RO_MODE(fw_platform_size, 0400);

static struct attribute *efi_subsys_attrs[] = {
&efi_attr_systab.attr,
--
2.14.1