浏览代码

libnvdimm, pfn: fix uuid validation

If we detect a namespace has a stale info block in the init path, we
should overwrite with the latest configuration.  In fact, we already
return -ENODEV when the parent uuid is invalid, the same should be done
for the 'self' uuid.  Otherwise we can get into a condition where
userspace is unable to reconfigure the pfn-device without directly /
manually invalidating the info block.

Cc: <stable@vger.kernel.org>
Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams 9 年之前
父节点
当前提交
e5670563f5
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/nvdimm/pfn_devs.c

+ 1 - 1
drivers/nvdimm/pfn_devs.c

@@ -376,7 +376,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn)
 	} else {
 	} else {
 		/* from init we validate */
 		/* from init we validate */
 		if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0)
 		if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0)
-			return -EINVAL;
+			return -ENODEV;
 	}
 	}
 
 
 	if (nd_pfn->align > nvdimm_namespace_capacity(ndns)) {
 	if (nd_pfn->align > nvdimm_namespace_capacity(ndns)) {