We call is_namespace_active() to check that the namespace is not active before we clobber it, but we were failing to check if we have a namespace at all. Without this check we segfault when attempting to create a namespace on a disabled region.
Signed-off-by: Dan Williams <[email protected]> --- ndctl/builtin-xaction-namespace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c index 13811ea22da1..9b1702d2feeb 100644 --- a/ndctl/builtin-xaction-namespace.c +++ b/ndctl/builtin-xaction-namespace.c @@ -552,7 +552,7 @@ static int namespace_create(struct ndctl_region *region) p.size = available; ndns = ndctl_region_get_namespace_seed(region); - if (is_namespace_active(ndns)) { + if (!ndns || is_namespace_active(ndns)) { debug("%s: no %s namespace seed\n", devname, ndns ? "idle" : "available"); return -ENODEV; @@ -685,7 +685,7 @@ static int namespace_reconfig(struct ndctl_region *region, return rc; ndns = ndctl_region_get_namespace_seed(region); - if (is_namespace_active(ndns)) { + if (!ndns || is_namespace_active(ndns)) { debug("%s: no %s namespace seed\n", ndctl_region_get_devname(region), ndns ? "idle" : "available"); _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
