]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.103/libnvdimm-namespace-make-resource-attribute-only-readable-by-root.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.103 / libnvdimm-namespace-make-resource-attribute-only-readable-by-root.patch
CommitLineData
5f59e284
GKH
1From c1fb3542074fd0c4d901d778bd52455111e4eb6f Mon Sep 17 00:00:00 2001
2From: Dan Williams <dan.j.williams@intel.com>
3Date: Tue, 26 Sep 2017 11:21:24 -0700
4Subject: libnvdimm, namespace: make 'resource' attribute only readable by root
5
6From: Dan Williams <dan.j.williams@intel.com>
7
8commit c1fb3542074fd0c4d901d778bd52455111e4eb6f upstream.
9
10For the same reason that /proc/iomem returns 0's for non-root readers
11and acpi tables are root-only, make the 'resource' attribute for
12namespace devices only readable by root. Otherwise we disclose physical
13address information.
14
15Fixes: bf9bccc14c05 ("libnvdimm: pmem label sets and namespace instantiation")
16Reported-by: Dave Hansen <dave.hansen@linux.intel.com>
17Signed-off-by: Dan Williams <dan.j.williams@intel.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20---
21 drivers/nvdimm/namespace_devs.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24--- a/drivers/nvdimm/namespace_devs.c
25+++ b/drivers/nvdimm/namespace_devs.c
26@@ -1305,7 +1305,7 @@ static umode_t namespace_visible(struct
27 if (a == &dev_attr_resource.attr) {
28 if (is_namespace_blk(dev))
29 return 0;
30- return a->mode;
31+ return 0400;
32 }
33
34 if (is_namespace_pmem(dev) || is_namespace_blk(dev)) {