Commit 3cccda8d authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

ipv6: move np->repflow to atomic flags



Move np->repflow to inet->inet_flags to fix data-races.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3fa29971
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -244,7 +244,6 @@ struct ipv6_pinfo {

	/* sockopt flags */
	__u16			sndflow:1,
				repflow:1,
				pmtudisc:3,
				padding:1,	/* 1 bit hole */
				srcprefs:3,	/* 001: prefer temporary address
+1 −0
Original line number Diff line number Diff line
@@ -275,6 +275,7 @@ enum {
	INET_FLAGS_AUTOFLOWLABEL = 24,
	INET_FLAGS_DONTFRAG	= 25,
	INET_FLAGS_RECVERR6	= 26,
	INET_FLAGS_REPFLOW	= 27,
};

/* cmsg flags for inet */
+1 −1
Original line number Diff line number Diff line
@@ -679,7 +679,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
			WRITE_ONCE(np->mcast_hops, ipv6_hdr(opt_skb)->hop_limit);
		if (np->rxopt.bits.rxflow || np->rxopt.bits.rxtclass)
			np->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(opt_skb));
		if (np->repflow)
		if (inet6_test_bit(REPFLOW, sk))
			np->flow_label = ip6_flowlabel(ipv6_hdr(opt_skb));
		if (ipv6_opt_accepted(sk, opt_skb,
				      &DCCP_SKB_CB(opt_skb)->header.h6)) {
+2 −1
Original line number Diff line number Diff line
@@ -220,7 +220,8 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,
	inet6_set_bit(MC6_LOOP, sk);
	inet6_set_bit(MC6_ALL, sk);
	np->pmtudisc	= IPV6_PMTUDISC_WANT;
	np->repflow	= net->ipv6.sysctl.flowlabel_reflect & FLOWLABEL_REFLECT_ESTABLISHED;
	inet6_assign_bit(REPFLOW, sk, net->ipv6.sysctl.flowlabel_reflect &
				     FLOWLABEL_REFLECT_ESTABLISHED);
	sk->sk_ipv6only	= net->ipv6.sysctl.bindv6only;
	sk->sk_txrehash = READ_ONCE(net->core.sysctl_txrehash);

+4 −4
Original line number Diff line number Diff line
@@ -513,7 +513,7 @@ int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
		return 0;
	}

	if (np->repflow) {
	if (inet6_test_bit(REPFLOW, sk)) {
		freq->flr_label = np->flow_label;
		return 0;
	}
@@ -551,10 +551,10 @@ static int ipv6_flowlabel_put(struct sock *sk, struct in6_flowlabel_req *freq)
	if (freq->flr_flags & IPV6_FL_F_REFLECT) {
		if (sk->sk_protocol != IPPROTO_TCP)
			return -ENOPROTOOPT;
		if (!np->repflow)
		if (!inet6_test_bit(REPFLOW, sk))
			return -ESRCH;
		np->flow_label = 0;
		np->repflow = 0;
		inet6_clear_bit(REPFLOW, sk);
		return 0;
	}

@@ -626,7 +626,7 @@ static int ipv6_flowlabel_get(struct sock *sk, struct in6_flowlabel_req *freq,

		if (sk->sk_protocol != IPPROTO_TCP)
			return -ENOPROTOOPT;
		np->repflow = 1;
		inet6_set_bit(REPFLOW, sk);
		return 0;
	}

Loading