summaryrefslogtreecommitdiff
path: root/patches/net-add-a-lock-around-icmp_sk.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/net-add-a-lock-around-icmp_sk.patch')
-rw-r--r--patches/net-add-a-lock-around-icmp_sk.patch53
1 files changed, 23 insertions, 30 deletions
diff --git a/patches/net-add-a-lock-around-icmp_sk.patch b/patches/net-add-a-lock-around-icmp_sk.patch
index 5734d88ef3da..523f6fbe4352 100644
--- a/patches/net-add-a-lock-around-icmp_sk.patch
+++ b/patches/net-add-a-lock-around-icmp_sk.patch
@@ -9,8 +9,8 @@ here a local lock. No crash has been observed, this is just precaution.
Cc: stable-rt@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
- net/ipv4/icmp.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
+ net/ipv4/icmp.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -31,42 +31,35 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static struct sock *icmp_sk(struct net *net)
{
return *this_cpu_ptr(net->ipv4.icmp_sk);
-@@ -215,12 +218,14 @@ static inline struct sock *icmp_xmit_loc
+@@ -417,6 +420,7 @@ static void icmp_reply(struct icmp_bxm *
+ /* Needed by both icmp_global_allow and icmp_xmit_lock */
local_bh_disable();
-
+ local_lock(icmp_sk_lock);
- sk = icmp_sk(net);
- if (unlikely(!spin_trylock(&sk->sk_lock.slock))) {
- /* This can happen if the output path signals a
- * dst_link_failure() for an outgoing ICMP packet.
- */
-+ local_unlock(icmp_sk_lock);
- local_bh_enable();
- return NULL;
- }
-@@ -230,6 +235,7 @@ static inline struct sock *icmp_xmit_loc
- static inline void icmp_xmit_unlock(struct sock *sk)
- {
- spin_unlock_bh(&sk->sk_lock.slock);
+ /* global icmp_msgs_per_sec */
+ if (!icmpv4_global_allow(net, type, code))
+@@ -461,6 +465,7 @@ static void icmp_reply(struct icmp_bxm *
+ out_unlock:
+ icmp_xmit_unlock(sk);
+ out_bh_enable:
+ local_unlock(icmp_sk_lock);
+ local_bh_enable();
}
- int sysctl_icmp_msgs_per_sec __read_mostly = 1000;
-@@ -358,6 +364,7 @@ static void icmp_push_reply(struct icmp_
- struct sock *sk;
- struct sk_buff *skb;
+@@ -673,6 +678,7 @@ void icmp_send(struct sk_buff *skb_in, i
+ /* Needed by both icmp_global_allow and icmp_xmit_lock */
+ local_bh_disable();
+ local_lock(icmp_sk_lock);
- sk = icmp_sk(dev_net((*rt)->dst.dev));
- if (ip_append_data(sk, fl4, icmp_glue_bits, icmp_param,
- icmp_param->data_len+icmp_param->head_len,
-@@ -380,6 +387,7 @@ static void icmp_push_reply(struct icmp_
- skb->ip_summed = CHECKSUM_NONE;
- ip_push_pending_frames(sk, fl4);
- }
+
+ /* Check global sysctl_icmp_msgs_per_sec ratelimit */
+ if (!icmpv4_global_allow(net, type, code))
+@@ -757,6 +763,7 @@ void icmp_send(struct sk_buff *skb_in, i
+ out_unlock:
+ icmp_xmit_unlock(sk);
+ out_bh_enable:
+ local_unlock(icmp_sk_lock);
+ local_bh_enable();
+ out:;
}
-
- /*