Commit d2c13561 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

inet: add READ_ONCE(sk->sk_bound_dev_if) in inet_csk_bind_conflict()

inet_csk_bind_conflict() can access sk->sk_bound_dev_if for
unlocked sockets.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36f7cec4
...@@ -155,10 +155,14 @@ static int inet_csk_bind_conflict(const struct sock *sk, ...@@ -155,10 +155,14 @@ static int inet_csk_bind_conflict(const struct sock *sk,
*/ */
sk_for_each_bound(sk2, &tb->owners) { sk_for_each_bound(sk2, &tb->owners) {
if (sk != sk2 && int bound_dev_if2;
(!sk->sk_bound_dev_if ||
!sk2->sk_bound_dev_if || if (sk == sk2)
sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { continue;
bound_dev_if2 = READ_ONCE(sk2->sk_bound_dev_if);
if ((!sk->sk_bound_dev_if ||
!bound_dev_if2 ||
sk->sk_bound_dev_if == bound_dev_if2)) {
if (reuse && sk2->sk_reuse && if (reuse && sk2->sk_reuse &&
sk2->sk_state != TCP_LISTEN) { sk2->sk_state != TCP_LISTEN) {
if ((!relax || if ((!relax ||
......
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