Skip to content

Commit

Permalink
net: devlink: Fix missing mutex_unlock() call
Browse files Browse the repository at this point in the history
Commit 2dec18a 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: 2dec18a ("net: devlink: remove region snapshots list dependency on devlink->lock")
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20220801115742.1309329-1-ammar.faizi@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
ammarfaizi2 authored and kuba-moo committed Aug 1, 2022
1 parent d81c7cd commit 80ef928
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 80ef928

Please sign in to comment.