Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9108039pxu; Mon, 28 Dec 2020 06:51:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWXlk/lqnmPSrl9Ha9Y5gEW1zxEgBPVqDSZvYeFIq8R7B4qMjNfP19vS9iuFNmRLdqSIrb X-Received: by 2002:a17:906:fa88:: with SMTP id lt8mr42085230ejb.408.1609167060280; Mon, 28 Dec 2020 06:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167060; cv=none; d=google.com; s=arc-20160816; b=1B7T0Ltw9VdYliwSvjMlu6pVM8VEu8SyDyRKoKIx3xrG2K/RRxLYY2uVKWbVoPNmgK O0Uvk4XsUYt3IFfv3KYb38rFKB55D5ghM2QGownJT/n+Uk0zpx1VcLA7/boTCQ7I1IU/ cyogY1/eMHY/bSq6fXYCtWkqKrPqURCzVG6Mz5IVDSid3ndrK2sf8RJonovbOVQE/7uz UAF+KmjE5A0wrl8w/35hD88IY0c0d9UWKe/lePW54c4vspYqX2u1KvNPx2IsJdsDRqKz GXNET9+ZtdGMXN5MRI3ZDQyPiBHq+xuZgdHLdyp625zAmjtfm4PnUjMnuzsoNPvFQsK8 QEDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5Yb6+nhTQFe4g1cXhmeFGiTUSYFhuvjL7ukzbgz9oGY=; b=qn5ZQfFXh5ATFCLvbXqhrmmHT8NkSYS0s1XiuyI7W8oVsmUs5qCPRqRW2Xz+y0ZvTG 8+tGJcq04FFkPqb7whG1F7EVF6QebNl2+iwRyOcJPXFdNtrVlzuDR0WrYUlgs2RA8FHE QYc15XztMLD38mzaMCJKkma2q9BMBmFMn5QGpm/GMVnIbMtNqTHZ/tw0Oglccc6LxW3T 08lF0c2qPv+tIJ56s/gOadH9t2mqvOXReG4igPZqFbfWCZSzVgNfY6HpFIMrw1KX0nOy j3V5HowPPlPRP6c0g9SLN8a/C1T4bqGwQmsOCAW+puPX5//4dcGByz6+/vgpXWAXTtZj u/fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r9lXR4tS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si20015407edr.321.2020.12.28.06.50.37; Mon, 28 Dec 2020 06:51:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r9lXR4tS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502396AbgL1Oro (ORCPT + 99 others); Mon, 28 Dec 2020 09:47:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:57978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502790AbgL1OX2 (ORCPT ); Mon, 28 Dec 2020 09:23:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5B19D229C4; Mon, 28 Dec 2020 14:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165392; bh=ZnULBoh5qmZPHWWE9q2VxdVQt5TjHmDwwe8aLxDIELM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r9lXR4tSbg4TMa3eIb7q8mcEsvrMdtwz6YfI+RQzYPu2Geo4difDveOWAqFLMF3YR ZfyySzHW9O6ZmNVeYp4xg9EKl+i/aPP+n+CfxZV8de7c8Z3AL1it8RP27fPlKEYi0Y o2iRLQejTUL6/ABF4cmNUHqiMzCfeAkuktSUwltk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Dan Williams , Sasha Levin Subject: [PATCH 5.10 474/717] libnvdimm/label: Return -ENXIO for no slot in __blk_label_update Date: Mon, 28 Dec 2020 13:47:52 +0100 Message-Id: <20201228125043.675191244@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit 4c46764733c85b82c07e9559b39da4d00a7dd659 ] Forget to set error code when nd_label_alloc_slot failed, and we add it to avoid overwritten error code. Fixes: 0ba1c634892b ("libnvdimm: write blk label set") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201205115056.2076523-1-zhangqilong3@huawei.com Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/nvdimm/label.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c index 47a4828b8b310..05c1f186a6be8 100644 --- a/drivers/nvdimm/label.c +++ b/drivers/nvdimm/label.c @@ -999,8 +999,10 @@ static int __blk_label_update(struct nd_region *nd_region, if (is_old_resource(res, old_res_list, old_num_resources)) continue; /* carry-over */ slot = nd_label_alloc_slot(ndd); - if (slot == UINT_MAX) + if (slot == UINT_MAX) { + rc = -ENXIO; goto abort; + } dev_dbg(ndd->dev, "allocated: %d\n", slot); nd_label = to_label(ndd, slot); -- 2.27.0