Skip to content

Commit 6bef98b

Browse files
t-8chgregkh
authored andcommitted
nvmem: core: limit cell sysfs permissions to main attribute ones
The cell sysfs attribute should not provide more access to the nvmem data than the main attribute itself. For example if nvme_config::root_only was set, the cell attribute would still provide read access to everybody. Mask out permissions not available on the main attribute. Fixes: 0331c61 ("nvmem: core: Expose cells through sysfs") Cc: [email protected] Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0ba424c commit 6bef98b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvmem/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
462462
"%s@%x,%x", entry->name,
463463
entry->offset,
464464
entry->bit_offset);
465-
attrs[i].attr.mode = 0444;
465+
attrs[i].attr.mode = 0444 & nvmem_bin_attr_get_umode(nvmem);
466466
attrs[i].size = entry->bytes;
467467
attrs[i].read = &nvmem_cell_attr_read;
468468
attrs[i].private = entry;

0 commit comments

Comments
 (0)