Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1956355imn; Mon, 1 Aug 2022 06:15:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbDjpIC4ZBGbVPkK3GavqbNPPsIZ7VIG+auJV65iOd+4w1uTARLZO1C8lo81oP/mf1/tPf X-Received: by 2002:a63:2c90:0:b0:40c:fe76:59ef with SMTP id s138-20020a632c90000000b0040cfe7659efmr13053934pgs.288.1659359729862; Mon, 01 Aug 2022 06:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659359729; cv=none; d=google.com; s=arc-20160816; b=SHm5o/g3NxbDYpNkUGucNqqnIMOhacxRVk4fhJtpPQ/dIdpKB8F3AZs6qZDDw0fDr3 B6Vlq/6JCIMoyH/QQTW346Q3GgfjrU4exFknbhyPg35tNaTyWEgyY2qs0PbUrbjvqskt twcII6U44XtXJBVeGbmD4ltg2pbmf2l1CS0QFuHqFCO0BYVgZl276l0LMFK/uxPpXIsk IxMOLRPEOLHKUCMSRkWxwUukE5f2sgDPc4DyciYDnB+CpGWXLUOpSa5IjtVPUdYdL9dp uReXr/o4bCgERtrw/AMHIIqrqK2BhyGpxzNVSKFCjOmHENIrLo9Z9rfCdJ28ElkmmMIa jmIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AcxMiNWFiX22GzzKne9K/hWlCev7ReqTaTgmXUvo9gc=; b=kVk+pRYGj22nnjel9tBu8NE5ZXmCY/DCdHUr0YSfPnx7KXCrhAdqce4WYHYipMg/Xk cF7MBnCfumk2YnsNFPT6CM2Ymvpug8ffCj4vOViGbiYIKiP1CaXaplsX+U8dUD5lN5EZ E6/9ShiD/79OPmseYhcep5j0sdaQikgYeIfdr8eCg25Y91hUJDSM6tnk/lxeTer92/eN JTQ6WPhOwxq3Fw1BA8LfaxTnC8KLdK/OWpwRVjiv4LSCLa/A913ctbHEtG7Eaue24a4F +8T3ep5g8KxECzjsPZIc8yYxh6uTMZGVovs15WX66zua1JGBZd6ShEfhN5y1LrKAaCsI 6aeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=UdkuVedw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c135-20020a621c8d000000b005251cc7fa4esi11757213pfc.75.2022.08.01.06.15.15; Mon, 01 Aug 2022 06:15:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b=UdkuVedw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230422AbiHAMVe (ORCPT + 99 others); Mon, 1 Aug 2022 08:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234484AbiHAMUT (ORCPT ); Mon, 1 Aug 2022 08:20:19 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 700A66359; Mon, 1 Aug 2022 05:00:14 -0700 (PDT) Received: from integral2.. (unknown [125.160.110.15]) by gnuweeb.org (Postfix) with ESMTPSA id 1DD627E24B; Mon, 1 Aug 2022 12:00:09 +0000 (UTC) X-GW-Data: lPqxHiMPbJw1wb7CM9QUryAGzr0yq5atzVDdxTR0iA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1659355213; bh=1CxphM8mT7LexVSNdtj4rN64OESklygPtbgpgoZ2cjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UdkuVedwwkU8KBKc1UvD6yl1x1Rxj154rCtYlaHEC1eX/hh/5iJNNTYDgtyfztW9K P5PFyJtVvClMepGqYyPY/Xcq6PxEzEXEiykCKzd1L4MFd16+DOcIhjrYWRb0YFdf9R oj2dkSc/BrXDbIKaUJDKEaRDTZg4i+7HTNYrv5a0eB+19LzDLWdm+I3vXRAtdX2Kjy ZbuUPB7+FvgNxTAuzjGGPFPNFr+v7Ut/r4otyT50HOGADXsq1DOheiVsY/mAekIuxF lCKxx8BtFwb3RTPdHbuwGUoGzjf1TnnME3qsw0SrSwSi7tJOBoyKfHFerw9tSocyv9 NelvvgqFFfZZg== From: Ammar Faizi To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Ammar Faizi , kernel test robot , Dan Carpenter , Moshe Shemesh , Jiri Pirko , Fernanda Ma'rouf , netdev Mailing List , GNU/Weeb Mailing List , Linux Kernel Mailing List , kbuild Mailing List , kbuild-all Mailing List Subject: [PATCH] net: devlink: Fix missing mutex_unlock() call Date: Mon, 1 Aug 2022 18:59:56 +0700 Message-Id: <20220801115742.1309329-1-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <202207311503.QBFSGqiL-lkp@intel.com> References: <202207311503.QBFSGqiL-lkp@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ammar Faizi Commit 2dec18ad826f forgets to call mutex_unlock() before the function returns in the error path: New smatch warnings: net/core/devlink.c:6392 devlink_nl_cmd_region_new() warn: inconsistent \ returns '®ion->snapshot_lock'. Make sure we call mutex_unlock() in this error path. Reported-by: kernel test robot Reported-by: Dan Carpenter Fixes: 2dec18ad826f52658f7781ee995d236cc449b678 ("net: devlink: remove region snapshots list dependency on devlink->lock") Signed-off-by: Ammar Faizi --- net/core/devlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/devlink.c b/net/core/devlink.c index 889e7e3d3e8a..5da5c7cca98a 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -6315,8 +6315,10 @@ devlink_nl_cmd_region_new(struct sk_buff *skb, struct genl_info *info) snapshot = devlink_region_snapshot_get_by_id(region, snapshot_id); - if (WARN_ON(!snapshot)) - return -EINVAL; + if (WARN_ON(!snapshot)) { + err = -EINVAL; + goto unlock; + } msg = devlink_nl_region_notify_build(region, snapshot, DEVLINK_CMD_REGION_NEW, base-commit: 0a324c3263f1e456f54dd8dc8ce58575aea776bc -- Ammar Faizi