On 5/8/23 12:46 PM, Dave Jiang wrote:
Yi reported [1] the key blob is not removed after an overwrite operation is
performed. Issue is discovered when running ndtest. Add the key blob
removal call to address the issue.
[1]: https://github.com/pmem/ndctl/issues/239
Fixes: 8e4193885357 ("ndctl: add an overwrite option to 'sanitize-dimm'")
Reported-by: Yi Zhang <yi.zh...@redhat.com>
Signed-off-by: Dave Jiang <dave.ji...@intel.com>
Please ignore patch.
---
ndctl/keys.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ndctl/keys.c b/ndctl/keys.c
index 2c1f474896c6..3fa076402cfc 100644
--- a/ndctl/keys.c
+++ b/ndctl/keys.c
@@ -658,7 +658,7 @@ int ndctl_dimm_overwrite_key(struct ndctl_dimm *dimm)
int rc;
key = check_dimm_key(dimm, false, ND_USER_KEY);
- if (key < 0)
+ if (key < 0 && key != -ENOKEY)
return key;
rc = run_key_op(dimm, key, ndctl_dimm_overwrite,
@@ -666,5 +666,8 @@ int ndctl_dimm_overwrite_key(struct ndctl_dimm *dimm)
if (rc < 0)
return rc;
+ if (key >= 0)
+ discard_key(dimm, ND_USER_KEY);
+
return 0;
}