Blob Blame History Raw
From b93eaf8e5fd3d6ae5c33e11957416a8461194f4e Mon Sep 17 00:00:00 2001
From: "Bernat, Yehezkel" <yehezkel.bernat@intel.com>
Date: Tue, 15 Aug 2017 08:19:12 +0300
Subject: [PATCH 32/34] thunderbolt: Make key root-only accessible
Git-commit: 0956e41169222822d3557871fcd1d32e4fa7e934
Patch-mainline: v4.14-rc1
References: FATE#323948

Non-root user may read the key back after root wrote it there.
This removes read access to everyone but root.

Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/thunderbolt/switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 69fde0b30eda..8510abcee5d2 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -826,7 +826,7 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr,
 	mutex_unlock(&switch_lock);
 	return ret;
 }
-static DEVICE_ATTR_RW(key);
+static DEVICE_ATTR(key, 0600, key_show, key_store);
 
 static ssize_t nvm_authenticate_show(struct device *dev,
 	struct device_attribute *attr, char *buf)
-- 
2.12.3