FAILED: patch "[PATCH] ip: Fix data-races around sysctl_ip_default_ttl." failed to apply to 4.9-stable tree
Subsystems (6)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 8281b7ec5c56b71cb2cc5a1728b41607be66959c Mon Sep 17 00:00:00 2001
From: Kuniyuki Iwashima <[email protected]>
Date: Wed, 13 Jul 2022 13:51:51 -0700
Subject: [PATCH] ip: Fix data-races around sysctl_ip_default_ttl.
While reading sysctl_ip_default_ttl, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by Kuniyuki Iwashima <[email protected]>
Signed-off-by David S. Miller <[email protected]>
drivers/net/ethernet/netronome/nfp/flower/action.c +1 -1
@@ -474,7 +474,7 @@ nfp_fl_set_tun(struct nfp_app *app, struct nfp_fl_set_tun *set_tun, set_tun->ttl =ip4_dst_hoplimit (&rt->dst);ip_rt_put (rt); }else { - set_tun->ttl = net->ipv4.sysctl_ip_default_ttl; + set_tun->ttl =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); } }
include/net/route.h +1 -1
@@ -373,7 +373,7 @@ static inline int ip4_dst_hoplimit(const struct dst_entry *dst)struct net *net =dev_net (dst->dev);if (hoplimit ==0 ) - hoplimit = net->ipv4.sysctl_ip_default_ttl; + hoplimit =READ_ONCE (net->ipv4.sysctl_ip_default_ttl);return hoplimit; }
net/ipv4/ip_sockglue.c +1 -1
@@ -1606,7 +1606,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, {struct net *net =sock_net (sk); val = (inet->uc_ttl ==-1 ? - net->ipv4.sysctl_ip_default_ttl : +READ_ONCE (net->ipv4.sysctl_ip_default_ttl) : inet->uc_ttl);break ; }
net/ipv4/netfilter/nf_reject_ipv4.c +2 -2
@@ -62,7 +62,7 @@ struct sk_buff *nf_reject_skb_v4_tcp_reset(struct net *net,skb_reserve (nskb,LL_MAX_HEADER ); niph =nf_reject_iphdr_put (nskb, oldskb,IPPROTO_TCP , - net->ipv4.sysctl_ip_default_ttl); +READ_ONCE (net->ipv4.sysctl_ip_default_ttl));nf_reject_ip_tcphdr_put (nskb, oldskb, oth); niph->tot_len =htons (nskb->len);ip_send_check (niph);
@@ -117,7 +117,7 @@ struct sk_buff *nf_reject_skb_v4_unreach(struct net *net,skb_reserve (nskb,LL_MAX_HEADER ); niph =nf_reject_iphdr_put (nskb, oldskb,IPPROTO_ICMP , - net->ipv4.sysctl_ip_default_ttl); +READ_ONCE (net->ipv4.sysctl_ip_default_ttl));skb_reset_transport_header (nskb); icmph =skb_put_zero (nskb,sizeof (struct icmphdr ));
net/ipv4/proc.c +1 -1
@@ -387,7 +387,7 @@ static int snmp_seq_show_ipstats(struct seq_file *seq, void *v)seq_printf (seq,"\nIp: %d %d" ,IPV4_DEVCONF_ALL (net,FORWARDING ) ?1 :2 , - net->ipv4.sysctl_ip_default_ttl); +READ_ONCE (net->ipv4.sysctl_ip_default_ttl));BUILD_BUG_ON (offsetof(struct ipstats_mib , mibs) !=0 ); snmp_get_cpu_field64_batch(buff64, snmp4_ipstats_list,
net/netfilter/nf_synproxy_core.c +1 -1
@@ -405,7 +405,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr, iph->tos =0 ; iph->id =0 ; iph->frag_off =htons (IP_DF ); - iph->ttl = net->ipv4.sysctl_ip_default_ttl; + iph->ttl =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); iph->protocol =IPPROTO_TCP ; iph->check =0 ; iph->saddr = saddr;