driver-core: Introduce DEVICE_ATTR_ADMIN_{RO,RW}
authorDan Williams <dan.j.williams@intel.com>
Thu, 25 Jun 2020 23:51:03 +0000 (16:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Jul 2020 17:16:30 +0000 (19:16 +0200)
commit3022c6a1b4b76c40aab9dcdf5142c501f3d3ae8c
tree0dee6f3f0602b3d13069f589dde950bc90854068
parent9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68
driver-core: Introduce DEVICE_ATTR_ADMIN_{RO,RW}

A common pattern for using plain DEVICE_ATTR() instead of
DEVICE_ATTR_RO() and DEVICE_ATTR_RW() is for attributes that want to
limit read to only root.  I.e. many users of DEVICE_ATTR() are
specifying 0400 or 0600 for permissions.

Given the expectation that CAP_SYS_ADMIN is needed to access these
sensitive attributes and an explicit helper with the _ADMIN_ identifier
for DEVICE_ATTR_ADMIN_{RO,RW}.

Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/159312906372.1850128.11611897078988158727.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/device.h
include/linux/sysfs.h