thunderbolt: Make key root-only accessible
authorBernat, Yehezkel <yehezkel.bernat@intel.com>
Tue, 15 Aug 2017 05:19:12 +0000 (08:19 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Aug 2017 14:21:32 +0000 (16:21 +0200)
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>
drivers/thunderbolt/switch.c

index 69fde0b30eda86bd01591f9b18578312bb26c4c4..8510abcee5d22241fe648f21fafbd57a116cadb5 100644 (file)
@@ -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)