Commit 4a2f7083 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by David S. Miller

icmp: Fix data-races around sysctl_icmp_echo_enable_probe.

While reading sysctl_icmp_echo_enable_probe, it can be changed
concurrently.  Thus, we need to add READ_ONCE() to its readers.

Fixes: d329ea5b ("icmp: add response to RFC 8335 PROBE messages")
Fixes: 1fd07f33 ("ipv6: ICMPV6: add response to ICMPV6 RFC 8335 PROBE messages")
Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bb7bb35a
...@@ -1028,7 +1028,7 @@ bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr) ...@@ -1028,7 +1028,7 @@ bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr)
u16 ident_len; u16 ident_len;
u8 status; u8 status;
if (!net->ipv4.sysctl_icmp_echo_enable_probe) if (!READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe))
return false; return false;
/* We currently only support probing interfaces on the proxy node /* We currently only support probing interfaces on the proxy node
......
...@@ -925,7 +925,7 @@ static int icmpv6_rcv(struct sk_buff *skb) ...@@ -925,7 +925,7 @@ static int icmpv6_rcv(struct sk_buff *skb)
break; break;
case ICMPV6_EXT_ECHO_REQUEST: case ICMPV6_EXT_ECHO_REQUEST:
if (!net->ipv6.sysctl.icmpv6_echo_ignore_all && if (!net->ipv6.sysctl.icmpv6_echo_ignore_all &&
net->ipv4.sysctl_icmp_echo_enable_probe) READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe))
icmpv6_echo_reply(skb); icmpv6_echo_reply(skb);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment