[PATCH 2/2] nvmet: Restrict in-band config files to root
Richard Weinberger
richard at nod.at
Sun Apr 20 03:47:26 PDT 2025
There is no need to have key material world readable.
Signed-off-by: Richard Weinberger <richard at nod.at>
---
drivers/nvme/target/configfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index e44ef69dffc2..7327543f161d 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -2128,7 +2128,7 @@ static ssize_t nvmet_host_dhchap_key_store(struct config_item *item,
return ret < 0 ? ret : count;
}
-CONFIGFS_ATTR(nvmet_host_, dhchap_key);
+CONFIGFS_ATTR_PERM(nvmet_host_, dhchap_key, S_IRUSR | S_IWUSR);
static ssize_t nvmet_host_dhchap_ctrl_key_show(struct config_item *item,
char *page)
@@ -2161,7 +2161,7 @@ static ssize_t nvmet_host_dhchap_ctrl_key_store(struct config_item *item,
return ret < 0 ? ret : count;
}
-CONFIGFS_ATTR(nvmet_host_, dhchap_ctrl_key);
+CONFIGFS_ATTR_PERM(nvmet_host_, dhchap_ctrl_key, S_IRUSR | S_IWUSR);
static ssize_t nvmet_host_dhchap_hash_show(struct config_item *item,
char *page)
@@ -2187,7 +2187,7 @@ static ssize_t nvmet_host_dhchap_hash_store(struct config_item *item,
return count;
}
-CONFIGFS_ATTR(nvmet_host_, dhchap_hash);
+CONFIGFS_ATTR_PERM(nvmet_host_, dhchap_hash, S_IRUSR | S_IWUSR);
static ssize_t nvmet_host_dhchap_dhgroup_show(struct config_item *item,
char *page)
@@ -2217,7 +2217,7 @@ static ssize_t nvmet_host_dhchap_dhgroup_store(struct config_item *item,
return count;
}
-CONFIGFS_ATTR(nvmet_host_, dhchap_dhgroup);
+CONFIGFS_ATTR_PERM(nvmet_host_, dhchap_dhgroup, S_IRUSR | S_IWUSR);
static struct configfs_attribute *nvmet_host_attrs[] = {
&nvmet_host_attr_dhchap_key,
--
2.48.1
More information about the Linux-nvme
mailing list