Revert "ipv4: fix data-races around inet->inet_id"
This reverts commit 417e7ec0d6
which is
commit f866fbc842de5976e41ba874b76ce31710b634b5 upstream.
It breaks the Android kernel abi. If this is needed in the future, it
can come back in an abi-safe way.
Bug: 161946584
Cc: Eric Dumazet <edumazet@google.com>
Change-Id: Ib36deff93f4066ebd3c67ae440da5ac82948b5b3
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
acef80535a
commit
d78a231453
@ -1466,7 +1466,7 @@ static void make_established(struct sock *sk, u32 snd_isn, unsigned int opt)
|
||||
tp->write_seq = snd_isn;
|
||||
tp->snd_nxt = snd_isn;
|
||||
tp->snd_una = snd_isn;
|
||||
atomic_set(&inet_sk(sk)->inet_id, get_random_u16());
|
||||
inet_sk(sk)->inet_id = get_random_u16();
|
||||
assign_rxopt(sk, opt);
|
||||
|
||||
if (tp->rcv_wnd > (RCV_BUFSIZ_M << 10))
|
||||
|
@ -223,8 +223,8 @@ struct inet_sock {
|
||||
__s16 uc_ttl;
|
||||
__u16 cmsg_flags;
|
||||
struct ip_options_rcu __rcu *inet_opt;
|
||||
atomic_t inet_id;
|
||||
__be16 inet_sport;
|
||||
__u16 inet_id;
|
||||
|
||||
__u8 tos;
|
||||
__u8 min_ttl;
|
||||
|
@ -534,19 +534,8 @@ static inline void ip_select_ident_segs(struct net *net, struct sk_buff *skb,
|
||||
* generator as much as we can.
|
||||
*/
|
||||
if (sk && inet_sk(sk)->inet_daddr) {
|
||||
int val;
|
||||
|
||||
/* avoid atomic operations for TCP,
|
||||
* as we hold socket lock at this point.
|
||||
*/
|
||||
if (sk_is_tcp(sk)) {
|
||||
sock_owned_by_me(sk);
|
||||
val = atomic_read(&inet_sk(sk)->inet_id);
|
||||
atomic_set(&inet_sk(sk)->inet_id, val + segs);
|
||||
} else {
|
||||
val = atomic_add_return(segs, &inet_sk(sk)->inet_id);
|
||||
}
|
||||
iph->id = htons(val);
|
||||
iph->id = htons(inet_sk(sk)->inet_id);
|
||||
inet_sk(sk)->inet_id += segs;
|
||||
return;
|
||||
}
|
||||
if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) {
|
||||
|
@ -130,7 +130,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
||||
inet->inet_daddr,
|
||||
inet->inet_sport,
|
||||
inet->inet_dport);
|
||||
atomic_set(&inet->inet_id, get_random_u16());
|
||||
inet->inet_id = get_random_u16();
|
||||
|
||||
err = dccp_connect(sk);
|
||||
rt = NULL;
|
||||
@ -435,7 +435,7 @@ struct sock *dccp_v4_request_recv_sock(const struct sock *sk,
|
||||
RCU_INIT_POINTER(newinet->inet_opt, rcu_dereference(ireq->ireq_opt));
|
||||
newinet->mc_index = inet_iif(skb);
|
||||
newinet->mc_ttl = ip_hdr(skb)->ttl;
|
||||
atomic_set(&newinet->inet_id, get_random_u16());
|
||||
newinet->inet_id = get_random_u16();
|
||||
|
||||
if (dst == NULL && (dst = inet_csk_route_child_sock(sk, newsk, req)) == NULL)
|
||||
goto put_and_exit;
|
||||
|
@ -340,7 +340,7 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
|
||||
else
|
||||
inet->pmtudisc = IP_PMTUDISC_WANT;
|
||||
|
||||
atomic_set(&inet->inet_id, 0);
|
||||
inet->inet_id = 0;
|
||||
|
||||
sock_init_data(sock, sk);
|
||||
|
||||
|
@ -73,7 +73,7 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
|
||||
reuseport_has_conns_set(sk);
|
||||
sk->sk_state = TCP_ESTABLISHED;
|
||||
sk_set_txhash(sk);
|
||||
atomic_set(&inet->inet_id, get_random_u16());
|
||||
inet->inet_id = get_random_u16();
|
||||
|
||||
sk_dst_set(sk, &rt->dst);
|
||||
err = 0;
|
||||
|
@ -312,7 +312,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
||||
inet->inet_daddr));
|
||||
}
|
||||
|
||||
atomic_set(&inet->inet_id, get_random_u16());
|
||||
inet->inet_id = get_random_u16();
|
||||
|
||||
if (tcp_fastopen_defer_connect(sk, &err))
|
||||
return err;
|
||||
@ -1539,7 +1539,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
|
||||
inet_csk(newsk)->icsk_ext_hdr_len = 0;
|
||||
if (inet_opt)
|
||||
inet_csk(newsk)->icsk_ext_hdr_len = inet_opt->opt.optlen;
|
||||
atomic_set(&newinet->inet_id, get_random_u16());
|
||||
newinet->inet_id = get_random_u16();
|
||||
|
||||
/* Set ToS of the new socket based upon the value of incoming SYN.
|
||||
* ECT bits are set later in tcp_init_transfer().
|
||||
|
@ -9472,7 +9472,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
|
||||
newinet->inet_rcv_saddr = inet->inet_rcv_saddr;
|
||||
newinet->inet_dport = htons(asoc->peer.port);
|
||||
newinet->pmtudisc = inet->pmtudisc;
|
||||
atomic_set(&newinet->inet_id, get_random_u16());
|
||||
newinet->inet_id = get_random_u16();
|
||||
|
||||
newinet->uc_ttl = inet->uc_ttl;
|
||||
newinet->mc_loop = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user