[PATCH 2/2] nvmet: Restrict in-band config files to root

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Apr 21 23:32:00 PDT 2025


On 4/20/25 03:47, Richard Weinberger wrote:

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);
  

Patch looks good to me, can we do something like this and
use in the rest of the patch ?

#define NVMET_CFGFS_ATTR_DEF_PERM (S_IRUSR | S_IWUSR)

or

Create a helper on the top of CONFIGFS_ATTR_PERM to wrap
permission into that for all the CONFIGFS_ATTR_PERM()

calls ?

-ck




More information about the Linux-nvme mailing list