From patchwork Wed Mar 1 20:41:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 13156486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FB8CC7EE23 for ; Wed, 1 Mar 2023 20:41:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbjCAUlq (ORCPT ); Wed, 1 Mar 2023 15:41:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229657AbjCAUlo (ORCPT ); Wed, 1 Mar 2023 15:41:44 -0500 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5C34D62D for ; Wed, 1 Mar 2023 12:41:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=NAwBkP+hDpEg0MRUhqFonvkBRhC/h4PEyxznskx06tY=; b=RuTnQI84KDk8aoCe3j4oH7CqBv /fsIRDw/6oCOEQbxLgbNwFSFDw/X9Gru/AugSEgYSV66g42TRHx9Npec2/99gz84pbWRP5jzY1aI4 /b5EU+IYfINlT7nRYvaBwCZHqinHXwTexcxOHYbn90cbTW6RZC4b1Sa4XAAhP/U0U9WJI5c12t/Sd jS+1oxwJnbgBq6yJQUaERrhpER8kQjT5mI1Vl7lkq8jo/W07Yu7cUqnHRj/UrzU99PyBIqrc/VIoU byodGIa5/Sb6Od1f29015FvOWqkNK57q8zxkAD3SvILaSjVPUVDaaLnyYR3K42LLOrzPCrclCV20e ytIVpYfA==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pXTGd-006cu9-HQ; Wed, 01 Mar 2023 13:41:40 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1pXTGb-000ADg-28; Wed, 01 Mar 2023 13:41:37 -0700 From: Logan Gunthorpe To: linux-raid@vger.kernel.org, Jes Sorensen Cc: Guoqing Jiang , Xiao Ni , Mariusz Tkaczyk , Coly Li , Chaitanya Kulkarni , Jonmichael Hands , Stephen Bates , Martin Oliveira , David Sloan , Logan Gunthorpe , Kinga Tanska , Chaitanya Kulkarni Date: Wed, 1 Mar 2023 13:41:29 -0700 Message-Id: <20230301204135.39230-2-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230301204135.39230-1-logang@deltatee.com> References: <20230301204135.39230-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-raid@vger.kernel.org, jes@trained-monkey.org, guoqing.jiang@linux.dev, xni@redhat.com, colyli@suse.de, jm@chia.net, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, logang@deltatee.com, mariusz.tkaczyk@linux.intel.com, kinga.tanska@linux.intel.com, chaitanyak@nvidia.com, kch@nvidia.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH mdadm v7 1/7] Create: goto abort_locked instead of return 1 in error path X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org The return 1 after the fstat_is_blkdev() check should be replaced with an error return that goes through the error path to unlock resources locked by this function. Signed-off-by: Logan Gunthorpe Acked-by: Kinga Tanska Reviewed-by: Xiao Ni Reviewed-by: Chaitanya Kulkarni Acked-by: Coly Li --- Create.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Create.c b/Create.c index 953e73722518..2e8203ecdccd 100644 --- a/Create.c +++ b/Create.c @@ -939,7 +939,7 @@ int Create(struct supertype *st, char *mddev, goto abort_locked; } if (!fstat_is_blkdev(fd, dv->devname, &rdev)) - return 1; + goto abort_locked; inf->disk.major = major(rdev); inf->disk.minor = minor(rdev); }