netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: inet: diag: Fix an error handling
@ 2016-09-12  6:02 Christophe JAILLET
  2016-09-12 14:35 ` David Ahern
  2016-09-16 14:04 ` [lkp] [net] 70a8118a03: BUG: workqueue leaked lock or atomic: kworker/0:1/0x00000000/28 kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2016-09-12  6:02 UTC (permalink / raw)
  To: davem, kuznet, jmorris, yoshfuji, kaber
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

If 'inet_diag_lock_handler()' returns an error, we should not call
'inet_diag_unlock_handler()' on it.
'handler' is not a valid mutexc in this case.

This has been spotted with the folowing coccinelle script:
////////////////////////////
@@
expression x;
identifier f;
@@

*   if (IS_ERR(x))
    {
       ...
*      f(<+... x ...+>);
       ...
    }

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 net/ipv4/inet_diag.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index abfbe492ebfe..795af25cf84c 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -1134,7 +1134,6 @@ int inet_diag_handler_get_info(struct sk_buff *skb, struct sock *sk)
 
 	handler = inet_diag_lock_handler(sk->sk_protocol);
 	if (IS_ERR(handler)) {
-		inet_diag_unlock_handler(handler);
 		nlmsg_cancel(skb, nlh);
 		return PTR_ERR(handler);
 	}
-- 
2.7.4

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

end of thread, other threads:[~2016-09-16 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12  6:02 [PATCH] net: inet: diag: Fix an error handling Christophe JAILLET
2016-09-12 14:35 ` David Ahern
2016-09-12 18:20   ` Christophe JAILLET
2016-09-16 14:04 ` [lkp] [net] 70a8118a03: BUG: workqueue leaked lock or atomic: kworker/0:1/0x00000000/28 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).