summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-06-29 07:19:50 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-17 09:55:08 -0400
commit800161bd0209a8db77f66af283c379ff8d58d88d (patch)
treebf8ed2c9a581723f5879443fd0b35331649a24fe /drivers/thunderbolt
parent6463a4571ceefc43908df4b016d8d5d8b8e85357 (diff)
thunderbolt: Correct access permissions for active NVM contents
Firmware upgrade tools that decide which NVM image should be uploaded to the Thunderbolt controller need to access active parts of the NVM even if they are not run as root. The information in active NVM is not considered security critical so we can use the default permissions set by the NVMem framework. Writing the NVM image is still left as root only operation. While there mark the active NVM as read-only in the filesystem. Reported-by: Yehezkel Bernat <yehezkel.bernat@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andreas Noever <andreas.noever@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/switch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index ab3e8f410444..40219a706309 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -281,9 +281,11 @@ static struct nvmem_device *register_nvmem(struct tb_switch *sw, int id,
281 if (active) { 281 if (active) {
282 config.name = "nvm_active"; 282 config.name = "nvm_active";
283 config.reg_read = tb_switch_nvm_read; 283 config.reg_read = tb_switch_nvm_read;
284 config.read_only = true;
284 } else { 285 } else {
285 config.name = "nvm_non_active"; 286 config.name = "nvm_non_active";
286 config.reg_write = tb_switch_nvm_write; 287 config.reg_write = tb_switch_nvm_write;
288 config.root_only = true;
287 } 289 }
288 290
289 config.id = id; 291 config.id = id;
@@ -292,7 +294,6 @@ static struct nvmem_device *register_nvmem(struct tb_switch *sw, int id,
292 config.size = size; 294 config.size = size;
293 config.dev = &sw->dev; 295 config.dev = &sw->dev;
294 config.owner = THIS_MODULE; 296 config.owner = THIS_MODULE;
295 config.root_only = true;
296 config.priv = sw; 297 config.priv = sw;
297 298
298 return nvmem_register(&config); 299 return nvmem_register(&config);