Skip to content

Commit 6b65bc2

Browse files
weiyjdavem330
authored andcommitted
tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor()
In the error handling case of nla_nest_start() failed read_unlock_bh() is called to unlock a lock that had not been taken yet. sparse warns about the context imbalance as the following: net/tipc/monitor.c:799:23: warning: context imbalance in '__tipc_nl_add_monitor' - different lock contexts for basic block Fixes: cf6f7e1 ('tipc: dump monitor attributes') Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9d594b3 commit 6b65bc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tipc/monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,10 @@ int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg,
794794
return 0;
795795

796796
attr_msg_full:
797+
read_unlock_bh(&mon->lock);
797798
nla_nest_cancel(msg->skb, attrs);
798799
msg_full:
799800
genlmsg_cancel(msg->skb, hdr);
800-
read_unlock_bh(&mon->lock);
801801

802802
return -EMSGSIZE;
803803
}

0 commit comments

Comments
 (0)