diff options
author | Dave Jiang <dave.jiang@intel.com> | 2018-12-08 00:02:12 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2018-12-21 23:44:41 +0300 |
commit | 64e77c8c047fb91ea8c7800c1238108a72f0bf9c (patch) | |
tree | 59aef33ac371f18b005319560addc9c9c85dea9b /drivers/nvdimm/dimm_devs.c | |
parent | d2a4ac73f56a5d0709d28b41fec8d15e4500f8f1 (diff) | |
download | linux-64e77c8c047fb91ea8c7800c1238108a72f0bf9c.tar.xz |
acpi/nfit, libnvdimm: Add support for issue secure erase DSM to Intel nvdimm
Add support to issue a secure erase DSM to the Intel nvdimm. The
required passphrase is acquired from an encrypted key in the kernel user
keyring. To trigger the action, "erase <keyid>" is written to the
"security" sysfs attribute.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/dimm_devs.c')
-rw-r--r-- | drivers/nvdimm/dimm_devs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index 1cc3a6af3d0e..bc432b7c17b8 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -394,7 +394,8 @@ static ssize_t security_show(struct device *dev, #define OPS \ C( OP_FREEZE, "freeze", 1), \ C( OP_DISABLE, "disable", 2), \ - C( OP_UPDATE, "update", 3) + C( OP_UPDATE, "update", 3), \ + C( OP_ERASE, "erase", 2) #undef C #define C(a, b, c) a enum nvdimmsec_op_ids { OPS }; @@ -448,6 +449,9 @@ static ssize_t __security_store(struct device *dev, const char *buf, size_t len) } else if (i == OP_UPDATE) { dev_dbg(dev, "update %u %u\n", key, newkey); rc = nvdimm_security_update(nvdimm, key, newkey); + } else if (i == OP_ERASE) { + dev_dbg(dev, "erase %u\n", key); + rc = nvdimm_security_erase(nvdimm, key); } else return -EINVAL; @@ -498,7 +502,8 @@ static umode_t nvdimm_visible(struct kobject *kobj, struct attribute *a, int n) return 0; /* Are there any state mutation ops? */ if (nvdimm->sec.ops->freeze || nvdimm->sec.ops->disable - || nvdimm->sec.ops->change_key) + || nvdimm->sec.ops->change_key + || nvdimm->sec.ops->erase) return a->mode; return 0444; } |