All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor()
@ 2016-07-28  2:07 Wei Yongjun
  2016-07-28  9:50 ` Ying Xue
  2016-07-31  3:38 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2016-07-28  2:07 UTC (permalink / raw)
  To: Jon Maloy, Ying Xue, Parthasarathy Bhuvaragan, David S. Miller
  Cc: Wei Yongjun, netdev, tipc-discussion

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: cf6f7e1d5109 ('tipc: dump monitor attributes')
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
 net/tipc/monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index be70a57..b62caa1 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -794,10 +794,10 @@ int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg,
 	return 0;
 
 attr_msg_full:
+	read_unlock_bh(&mon->lock);
 	nla_nest_cancel(msg->skb, attrs);
 msg_full:
 	genlmsg_cancel(msg->skb, hdr);
-	read_unlock_bh(&mon->lock);
 
 	return -EMSGSIZE;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor()
  2016-07-28  2:07 [PATCH -next] tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor() Wei Yongjun
@ 2016-07-28  9:50 ` Ying Xue
  2016-07-31  3:38 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ying Xue @ 2016-07-28  9:50 UTC (permalink / raw)
  To: Wei Yongjun, Jon Maloy, Parthasarathy Bhuvaragan, David S. Miller
  Cc: netdev, tipc-discussion

On 07/28/2016 10:07 AM, Wei Yongjun wrote:
> 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: cf6f7e1d5109 ('tipc: dump monitor attributes')
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>

Acked-by: Ying Xue <ying.xue@windriver.com>

> ---
>  net/tipc/monitor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
> index be70a57..b62caa1 100644
> --- a/net/tipc/monitor.c
> +++ b/net/tipc/monitor.c
> @@ -794,10 +794,10 @@ int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg,
>  	return 0;
>  
>  attr_msg_full:
> +	read_unlock_bh(&mon->lock);
>  	nla_nest_cancel(msg->skb, attrs);
>  msg_full:
>  	genlmsg_cancel(msg->skb, hdr);
> -	read_unlock_bh(&mon->lock);
>  
>  	return -EMSGSIZE;
>  }
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor()
  2016-07-28  2:07 [PATCH -next] tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor() Wei Yongjun
  2016-07-28  9:50 ` Ying Xue
@ 2016-07-31  3:38 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-07-31  3:38 UTC (permalink / raw)
  To: weiyj.lk
  Cc: jon.maloy, ying.xue, parthasarathy.bhuvaragan, netdev, tipc-discussion

From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Thu, 28 Jul 2016 02:07:49 +0000

> 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: cf6f7e1d5109 ('tipc: dump monitor attributes')
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-31  3:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28  2:07 [PATCH -next] tipc: fix imbalance read_unlock_bh in __tipc_nl_add_monitor() Wei Yongjun
2016-07-28  9:50 ` Ying Xue
2016-07-31  3:38 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.