From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757943AbcC2S2t (ORCPT ); Tue, 29 Mar 2016 14:28:49 -0400 Received: from mga14.intel.com ([192.55.52.115]:56651 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757899AbcC2S2s (ORCPT ); Tue, 29 Mar 2016 14:28:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,412,1455004800"; d="scan'208";a="677542125" Subject: [PATCH] libnvdimm, pfn: fix uuid validation From: Dan Williams To: linux-nvdimm@ml01.01.org Cc: Jeff Moyer , linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Tue, 29 Mar 2016 11:28:09 -0700 Message-ID: <20160329182809.13112.73824.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Reported-by: Jeff Moyer Signed-off-by: Dan Williams --- drivers/nvdimm/pfn_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index 254d3bc13f70..e071e214feba 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -376,7 +376,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn) } else { /* from init we validate */ if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) - return -EINVAL; + return -ENODEV; } if (nd_pfn->align > nvdimm_namespace_capacity(ndns)) {