summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2017-09-21 14:42:04 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-01-17 10:08:36 -0500
commit211899cce7b35b7ee8854a4bcebedd4cba357d7d (patch)
treec9650955944ca0e4de65b66603564d3def5b10a9
parent5f494d1305dc9795fac6e4e4b11853eace98f723 (diff)
downloadlinux-rt-211899cce7b35b7ee8854a4bcebedd4cba357d7d.tar.gz
net: use trylock in icmp_sk
The locking path can be recursive (same as for sk->sk_lock.slock) and therefore we need a trylock version for the locallock, too. Cc: stable-rt@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--net/ipv4/icmp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 76b11e3e2b95..434eef536092 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -218,7 +218,11 @@ static inline struct sock *icmp_xmit_lock(struct net *net)
local_bh_disable();
- local_lock(icmp_sk_lock);
+ if (!local_trylock(icmp_sk_lock)) {
+ local_bh_enable();
+ return NULL;
+ }
+
sk = icmp_sk(net);
if (unlikely(!spin_trylock(&sk->sk_lock.slock))) {