public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: "David S. Miller" <[email protected]>,
	Eric Dumazet <[email protected]>,
	Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	kernel test robot <[email protected]>,
	Dan Carpenter <[email protected]>,
	Moshe Shemesh <[email protected]>, Jiri Pirko <[email protected]>,
	Fernanda Ma'rouf <[email protected]>,
	netdev Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Linux Kernel Mailing List <[email protected]>,
	kbuild Mailing List <[email protected]>,
	kbuild-all Mailing List <[email protected]>
Subject: [PATCH] net: devlink: Fix missing mutex_unlock() call
Date: Mon,  1 Aug 2022 18:59:56 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Ammar Faizi <[email protected]>

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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Fixes: 2dec18ad826f52658f7781ee995d236cc449b678 ("net: devlink: remove region snapshots list dependency on devlink->lock")
Signed-off-by: Ammar Faizi <[email protected]>
---
 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:00 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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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