[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250213064008.4032730-2-wangyuquan1236@phytium.com.cn>
Date: Thu, 13 Feb 2025 14:40:08 +0800
From: Yuquan Wang <wangyuquan1236@...tium.com.cn>
To: dave@...olabs.net,
jonathan.cameron@...wei.com,
dave.jiang@...el.com,
alison.schofield@...el.com,
vishal.l.verma@...el.com,
ira.weiny@...el.com,
dan.j.williams@...el.com
Cc: linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org,
Yuquan Wang <wangyuquan1236@...tium.com.cn>
Subject: [PATCH 1/1] cxl/pmem: debug invalid serial number data
In a nvdimm interleave-set each device with an invalid or zero
serial number may cause pmem region initialization to fail, but in
cxl case such device could still set cookies of nd_interleave_set
and create a nvdimm pmem region.
This adds the validation of serial number in cxl pmem region creation.
The event of no serial number would cause to fail to set the cookie
and pmem region.
Signed-off-by: Yuquan Wang <wangyuquan1236@...tium.com.cn>
---
drivers/cxl/pmem.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
index f9c95996e937..89f4eac49313 100644
--- a/drivers/cxl/pmem.c
+++ b/drivers/cxl/pmem.c
@@ -384,6 +384,13 @@ static int cxl_pmem_region_probe(struct device *dev)
};
info[i].offset = m->start;
info[i].serial = cxlds->serial;
+
+ if (info[i].serial == 0) {
+ dev_dbg(dev, "%s: invalid serial number\n",
+ dev_name(&cxlmd->dev));
+ rc = -ENXIO;
+ goto out_nvd;
+ }
}
ndr_desc.num_mappings = cxlr_pmem->nr_mappings;
ndr_desc.mapping = mappings;
--
2.34.1
Powered by blists - more mailing lists