From: Dan Williams Date: Thu, 28 Apr 2022 22:47:46 +0000 (-0700) Subject: nvdimm: Allow overwrite in the presence of disabled dimms X-Git-Tag: v6.1-rc5~1230^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb7bf697fed58eae9d3445944e457ab0de4da54f;p=platform%2Fkernel%2Flinux-starfive.git nvdimm: Allow overwrite in the presence of disabled dimms It is not clear why the original implementation of overwrite support required the dimm driver to be active before overwrite could proceed. In fact that can lead to cases where the kernel retains an invalid cached copy of the labels from before the overwrite. Unfortunately the kernel has not only allowed that case, but enforced it. Going forward, allow for overwrite to happen while the label area is offline, and follow-on with updates to 'ndctl sanitize-dimm --overwrite' to trigger the label area invalidation by default. Cc: Vishal Verma Cc: Dave Jiang Cc: Ira Weiny Cc: Jeff Moyer Reported-by: Krzysztof Kensicki Fixes: 7d988097c546 ("acpi/nfit, libnvdimm/security: Add security DSM overwrite support") Signed-off-by: Dan Williams --- diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c index 4b80150..b5aa55c 100644 --- a/drivers/nvdimm/security.c +++ b/drivers/nvdimm/security.c @@ -379,11 +379,6 @@ static int security_overwrite(struct nvdimm *nvdimm, unsigned int keyid) || !nvdimm->sec.flags) return -EOPNOTSUPP; - if (dev->driver == NULL) { - dev_dbg(dev, "Unable to overwrite while DIMM active.\n"); - return -EINVAL; - } - rc = check_security_state(nvdimm); if (rc) return rc;