Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2018-10-31 10:48:30 +0100
committerJohannes Thumshirn <jthumshirn@suse.de>2018-10-31 10:48:53 +0100
commit316addf534ddb59e0d668cf7ff83c62361ff7f7e (patch)
treee0b23b575f34d73914cd8dcfb21d40523f4977ed
parent186254745ff0906eead57e1653442c029a7270c0 (diff)
nvdimm: Sanity check labeloff (bsc#1111921, bsc#1113408,
-rw-r--r--patches.fixes/nvdimm-sanity-check-labeloff.patch36
-rw-r--r--series.conf1
2 files changed, 37 insertions, 0 deletions
diff --git a/patches.fixes/nvdimm-sanity-check-labeloff.patch b/patches.fixes/nvdimm-sanity-check-labeloff.patch
new file mode 100644
index 0000000000..29aa5c2e10
--- /dev/null
+++ b/patches.fixes/nvdimm-sanity-check-labeloff.patch
@@ -0,0 +1,36 @@
+From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
+Date: Wed, 10 Oct 2018 16:38:41 -0700
+Subject: nvdimm: Sanity check labeloff
+Git-commit: d86d4d63d88861107d3bfc84be7294552231ecd0
+Patch-mainline: v4.20-rc1
+References: bsc#1111921, bsc#1113408, FATE#326765
+
+This patch adds validation for the labeloff field in the indexes.
+
+Reviewed-by: Toshi Kani <toshi.kani@hpe.com>
+Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/nvdimm/label.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
+index 1d28cd656536..1f5842509dbc 100644
+--- a/drivers/nvdimm/label.c
++++ b/drivers/nvdimm/label.c
+@@ -183,6 +183,13 @@ static int __nd_label_validate(struct nvdimm_drvdata *ndd)
+ __le64_to_cpu(nsindex[i]->otheroff));
+ continue;
+ }
++ if (__le64_to_cpu(nsindex[i]->labeloff)
++ != 2 * sizeof_namespace_index(ndd)) {
++ dev_dbg(dev, "nsindex%d labeloff: %#llx invalid\n",
++ i, (unsigned long long)
++ __le64_to_cpu(nsindex[i]->labeloff));
++ continue;
++ }
+
+ size = __le64_to_cpu(nsindex[i]->mysize);
+ if (size > sizeof_namespace_index(ndd)
+
diff --git a/series.conf b/series.conf
index 9cf4189071..8c3c191e12 100644
--- a/series.conf
+++ b/series.conf
@@ -18053,6 +18053,7 @@
patches.drivers/net-smc-use-__aligned_u64-for-64-bit-smc_diag-fields.patch
patches.drivers/net-smc-retain-old-name-for-diag_mode-field.patch
patches.fixes/libnvdimm-dimm-maximize-label-transfer-size.patch
+ patches.fixes/nvdimm-sanity-check-labeloff.patch
# davem/net
patches.fixes/udp-Unbreak-modules-that-rely-on-external-__skb_recv.patch