All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl: fix create-namespace on disabled region fault
@ 2016-09-15 21:06 Dan Williams
  0 siblings, 0 replies; only message in thread
From: Dan Williams @ 2016-09-15 21:06 UTC (permalink / raw)
  To: linux-nvdimm

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 <dan.j.williams@intel.com>
---
 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
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-15 21:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 21:06 [ndctl PATCH] ndctl: fix create-namespace on disabled region fault Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.