mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
inet: add READ_ONCE(sk->sk_bound_dev_if) in inet_csk_bind_conflict()
[ Upstream commit d2c135619c ]
inet_csk_bind_conflict() can access sk->sk_bound_dev_if for
unlocked sockets.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
49aa080951
commit
9920e87a84
@@ -147,10 +147,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 ||
|
||||||
|
|||||||
Reference in New Issue
Block a user