On Mon, Nov 21, 2016 at 12:49 PM, Dave Jiang <dave.jiang(a)intel.com> wrote:
Clearing out the poison in the metadata block of the namespace
before
we use it. Range from start + 8k to pfn_sb->dataoff.
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
drivers/nvdimm/pfn_devs.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index cea8350..7fa428e 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -527,11 +527,39 @@ static struct vmem_altmap *__nvdimm_setup_pfn(struct nd_pfn
*nd_pfn,
.base_pfn = init_altmap_base(base),
.reserve = init_altmap_reserve(base),
};
+ sector_t sector;
+ resource_size_t meta_start, meta_size;
+ long cleared;
+ unsigned int sz_align;
memcpy(res, &nsio->res, sizeof(*res));
res->start += start_pad;
res->end -= end_trunc;
+ meta_start = res->start + SZ_8K;
+ meta_size = offset - meta_start + 1;
+
+ if (meta_start + meta_size > offset)
+ return ERR_PTR(-EINVAL);
I missed this patch in the libnvdimm pull request for 4.10-rc1. I
grabbed it for -rc2, but the lines above trigger a regression in the
unit tests. So I dropped it and we should try again with an updated
patch for 4.11 at this point.