mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Ammar Faizi <ammarfaizi2@gnuweeb.org>,
	kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Moshe Shemesh <moshe@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	Fernanda Ma'rouf <fernandafmr12@gnuweeb.org>,
	netdev Mailing List <netdev@vger.kernel.org>,
	GNU/Weeb Mailing List <gwml@vger.gnuweeb.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kbuild Mailing List <kbuild@lists.01.org>,
	kbuild-all Mailing List <kbuild-all@lists.01.org>
Subject: [PATCH] net: devlink: Fix missing mutex_unlock() call
Date: Mon,  1 Aug 2022 18:59:56 +0700	[thread overview]
Message-ID: <20220801115742.1309329-1-ammar.faizi@intel.com> (raw)
In-Reply-To: <202207311503.QBFSGqiL-lkp@intel.com>

From: Ammar Faizi <ammarfaizi2@gnuweeb.org>

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 '&region->snapshot_lock'.

Make sure we call mutex_unlock() in this error path.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 2dec18ad826f52658f7781ee995d236cc449b678 ("net: devlink: remove region snapshots list dependency on devlink->lock")
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---
 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


  reply	other threads:[~2022-08-01 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 11:29 [ammarfaizi2-block:netdev/net-next/main 20/29] net/core/devlink.c:6392 devlink_nl_cmd_region_new() warn: inconsistent returns '&region->snapshot_lock' Dan Carpenter
2022-08-01 11:59 ` Ammar Faizi [this message]
2022-08-01 14:40   ` [PATCH] net: devlink: Fix missing mutex_unlock() call Jiri Pirko
2022-08-01 19:50   ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220801115742.1309329-1-ammar.faizi@intel.com \
    --to=ammarfaizi2@gnuweeb.org \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fernandafmr12@gnuweeb.org \
    --cc=gwml@vger.gnuweeb.org \
    --cc=jiri@nvidia.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®