nvme: make the DH-HMAC-CHAP secret attributes readable by root only
Subsystems (2)
PATCH 1/1 nvme: make the DH-HMAC-CHAP secret attributes readable by root only
The dhchap_secret and dhchap_ctrl_secret sysfs attributes have mode 0644. Their show functions return the secret, so any local user can read the DH-HMAC-CHAP secrets of a connected controller.
Change the mode to 0600. Writing the attributes was already limited to root and is not changed.
--- drivers/nvme/host/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/sysfs.c +2 -2
@@ -864,7 +864,7 @@ static ssize_t nvme_ctrl_dhchap_secret_store(struct device *dev,return count; } -static DEVICE_ATTR(dhchap_secret, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(dhchap_secret, 0600, nvme_ctrl_dhchap_secret_show, nvme_ctrl_dhchap_secret_store); static ssize_t nvme_ctrl_dhchap_ctrl_secret_show(struct device *dev,
@@ -922,7 +922,7 @@ static ssize_t nvme_ctrl_dhchap_ctrl_secret_store(struct device *dev,return count; } -static DEVICE_ATTR(dhchap_ctrl_secret, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(dhchap_ctrl_secret, 0600, nvme_ctrl_dhchap_ctrl_secret_show, nvme_ctrl_dhchap_ctrl_secret_store);#endif
Signature · 1 line
2.53.0
Greg KH
maintainerQuoted 21 lines · Martin Belanger
The
dhchap_secretanddhchap_ctrl_secretsysfs attributes have mode 0644. Their show functions return the secret, so any local user can read the DH-HMAC-CHAP secrets of a connected controller.Change the mode to 0600. Writing the attributes was already limited to root and is not changed.
Fixes f50fff73d620 ("nvme: implement In-Band authentication")Cc Daniel Wagner <[email protected]>Assisted-by LLMSigned-off-by Martin Belanger <[email protected]>--- drivers/nvme/host/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/nvme/host/sysfs.c +0
-0
drivers/nvme/host/sysfs.c static ssize_t nvme_ctrl_dhchap_secret_store(struct device *dev, · line 868
Quoted 6 lines
drivers/nvme/host/sysfs.c +1
-1@@ -864,7 +864,7 @@ static ssize_t nvme_ctrl_dhchap_secret_store(struct device *dev,return count; } -static DEVICE_ATTR(dhchap_secret, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(dhchap_secret, 0600, nvme_ctrl_dhchap_secret_show, nvme_ctrl_dhchap_secret_store);
DEVICE_ATTR_ADMIN_RW() perhaps?
And no need to cc: [email protected] for public patches.
thanks,
greg k-h