mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
libnvdimm, region : make 'resource' attribute only readable by root
For the same reason that /proc/iomem returns 0's for non-root readers
and acpi tables are root-only, make the 'resource' attribute for region
devices only readable by root. Otherwise we disclose physical address
information.
Fixes: 802f4be6fe ("libnvdimm: Add 'resource' sysfs attribute to regions")
Cc: <[email protected]>
Cc: Dave Jiang <[email protected]>
Cc: Johannes Thumshirn <[email protected]>
Reported-by: Dave Hansen <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
This commit is contained in:
parent
d083e6dae0
commit
b8ff981f88
1 changed files with 6 additions and 2 deletions
|
|
@ -562,8 +562,12 @@ static umode_t region_visible(struct kobject *kobj, struct attribute *a, int n)
|
|||
if (!is_nd_pmem(dev) && a == &dev_attr_badblocks.attr)
|
||||
return 0;
|
||||
|
||||
if (!is_nd_pmem(dev) && a == &dev_attr_resource.attr)
|
||||
return 0;
|
||||
if (a == &dev_attr_resource.attr) {
|
||||
if (is_nd_pmem(dev))
|
||||
return 0400;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a == &dev_attr_deep_flush.attr) {
|
||||
int has_flush = nvdimm_has_flush(nd_region);
|
||||
|
|
|
|||
Loading…
Reference in a new issue