mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
nvme: expose TLS mode
It is not possible to determine the active TLS mode from the presence or absence of sysfs attributes like tls_key, tls_configured_key, or dhchap_secret. With the introduction of the concat mode and optional DH-CHAP authentication, different configurations can result in identical sysfs state. This makes user space detection unreliable. Expose the TLS mode explicitly to allow user space to unambiguously identify the active configuration and avoid fragile heuristics in nvme-cli. Reviewed-by: Chris Leech <cleech@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Daniel Wagner <wagi@kernel.org> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
ba9d308ccd
commit
20925812de
|
|
@ -883,10 +883,26 @@ static ssize_t tls_keyring_show(struct device *dev,
|
|||
}
|
||||
static DEVICE_ATTR_RO(tls_keyring);
|
||||
|
||||
static ssize_t tls_mode_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
|
||||
const char *mode;
|
||||
|
||||
if (ctrl->opts->tls)
|
||||
mode = "tls";
|
||||
else
|
||||
mode = "concat";
|
||||
|
||||
return sysfs_emit(buf, "%s\n", mode);
|
||||
}
|
||||
static DEVICE_ATTR_RO(tls_mode);
|
||||
|
||||
static struct attribute *nvme_tls_attrs[] = {
|
||||
&dev_attr_tls_key.attr,
|
||||
&dev_attr_tls_configured_key.attr,
|
||||
&dev_attr_tls_keyring.attr,
|
||||
&dev_attr_tls_mode.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
@ -908,6 +924,9 @@ static umode_t nvme_tls_attrs_are_visible(struct kobject *kobj,
|
|||
if (a == &dev_attr_tls_keyring.attr &&
|
||||
!ctrl->opts->keyring)
|
||||
return 0;
|
||||
if (a == &dev_attr_tls_mode.attr &&
|
||||
!ctrl->opts->tls && !ctrl->opts->concat)
|
||||
return 0;
|
||||
|
||||
return a->mode;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user