[PATCH] nvme: add 'static' suffix for user-specified TLS keys
Hannes Reinecke
hare at kernel.org
Mon Feb 26 04:24:49 PST 2024
From: Hannes Reinecke <hare at suse.de>
If the user specifies a specific TLS key via the '--tls_key'
option to nvme-cli we should be adding a ';static' suffix
to the 'tls_key' sysfs attribute to signal that this is a
user-specific key, and not one auto-selected during TLS
protocol negotiation.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
drivers/nvme/host/sysfs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index d099218e494a..79f25029c2fb 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -674,10 +674,14 @@ static ssize_t tls_key_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
+ char *suffix = "";
if (!ctrl->tls_key)
return 0;
- return sysfs_emit(buf, "%08x", key_serial(ctrl->tls_key));
+ if (ctrl->opts->tls_key)
+ suffix = ";static";
+ return sysfs_emit(buf, "%08x%s",
+ key_serial(ctrl->tls_key), suffix);
}
static DEVICE_ATTR_RO(tls_key);
#endif
--
2.35.3
More information about the Linux-nvme
mailing list