Skip to content

Commit d296ba6

Browse files
kraigatgoogdavem330
authored andcommitted
soreuseport: Resolve merge conflict for v4/v6 ordering fix
d894ba1 ("soreuseport: fix ordering for mixed v4/v6 sockets") was merged as a bug fix to the net tree. Two conflicting changes were committed to net-next before the above fix was merged back to net-next: ca065d0 ("udp: no longer use SLAB_DESTROY_BY_RCU") 3b24d85 ("tcp/dccp: do not touch listener sk_refcnt under synflood") These changes switched the datastructure used for TCP and UDP sockets from hlist_nulls to hlist. This patch applies the necessary parts of the net tree fix to net-next which were not automatic as part of the merge. Fixes: 1602f49 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net") Signed-off-by: Craig Gallek <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5e91f6c commit d296ba6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/net/sock.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,11 @@ static inline void sk_add_node(struct sock *sk, struct hlist_head *list)
630630
static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
631631
{
632632
sock_hold(sk);
633-
hlist_add_head_rcu(&sk->sk_node, list);
633+
if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport &&
634+
sk->sk_family == AF_INET6)
635+
hlist_add_tail_rcu(&sk->sk_node, list);
636+
else
637+
hlist_add_head_rcu(&sk->sk_node, list);
634638
}
635639

636640
static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)

net/ipv4/inet_hashtables.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,11 @@ int __inet_hash(struct sock *sk, struct sock *osk,
479479
if (err)
480480
goto unlock;
481481
}
482-
hlist_add_head_rcu(&sk->sk_node, &ilb->head);
482+
if (IS_ENABLED(CONFIG_IPV6) && sk->sk_reuseport &&
483+
sk->sk_family == AF_INET6)
484+
hlist_add_tail_rcu(&sk->sk_node, &ilb->head);
485+
else
486+
hlist_add_head_rcu(&sk->sk_node, &ilb->head);
483487
sock_set_flag(sk, SOCK_RCU_FREE);
484488
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
485489
unlock:

0 commit comments

Comments
 (0)