Skip to content

Commit 674f31a

Browse files
davejiangdjbw
authored andcommitted
libnvdimm: prevent nvdimm from requesting key when security is disabled
Current implementation attempts to request keys from the keyring even when security is not enabled. Change behavior so when security is disabled it will skip key request. Error messages seen when no keys are installed and libnvdimm is loaded: request-key[4598]: Cannot find command to construct key 661489677 request-key[4606]: Cannot find command to construct key 34713726 Cc: [email protected] Fixes: 4c6926a ("acpi/nfit, libnvdimm: Add unlock of nvdimm support for Intel DIMMs") Signed-off-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/156934642272.30222.5230162488753445916.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Dan Williams <[email protected]>
1 parent c42adf8 commit 674f31a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/nvdimm/security.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ static int __nvdimm_security_unlock(struct nvdimm *nvdimm)
177177
|| !nvdimm->sec.flags)
178178
return -EIO;
179179

180+
/* No need to go further if security is disabled */
181+
if (test_bit(NVDIMM_SECURITY_DISABLED, &nvdimm->sec.flags))
182+
return 0;
183+
180184
if (test_bit(NDD_SECURITY_OVERWRITE, &nvdimm->flags)) {
181185
dev_dbg(dev, "Security operation in progress.\n");
182186
return -EBUSY;

0 commit comments

Comments
 (0)