mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
DLM: fix to use sock_mutex correctly in xxx_accept_from_sock
In the current implementation, we think that exclusion control for othercon in tcp_accept_from_sock() and sctp_accept_from_sock() was not enough. We fix them. Signed-off-by: Tadashi Miyauchi <[email protected]> Signed-off-by: Tsutomu Owa <[email protected]> Signed-off-by: David Teigland <[email protected]>
This commit is contained in:
parent
b2a6662932
commit
c7355827b2
1 changed files with 6 additions and 0 deletions
|
|
@ -801,16 +801,19 @@ static int tcp_accept_from_sock(struct connection *con)
|
|||
INIT_WORK(&othercon->rwork, process_recv_sockets);
|
||||
set_bit(CF_IS_OTHERCON, &othercon->flags);
|
||||
}
|
||||
mutex_lock_nested(&othercon->sock_mutex, 2);
|
||||
if (!othercon->sock) {
|
||||
newcon->othercon = othercon;
|
||||
othercon->sock = newsock;
|
||||
newsock->sk->sk_user_data = othercon;
|
||||
add_sock(newsock, othercon);
|
||||
addcon = othercon;
|
||||
mutex_unlock(&othercon->sock_mutex);
|
||||
}
|
||||
else {
|
||||
printk("Extra connection from node %d attempted\n", nodeid);
|
||||
result = -EAGAIN;
|
||||
mutex_unlock(&othercon->sock_mutex);
|
||||
mutex_unlock(&newcon->sock_mutex);
|
||||
goto accept_err;
|
||||
}
|
||||
|
|
@ -918,15 +921,18 @@ static int sctp_accept_from_sock(struct connection *con)
|
|||
INIT_WORK(&othercon->rwork, process_recv_sockets);
|
||||
set_bit(CF_IS_OTHERCON, &othercon->flags);
|
||||
}
|
||||
mutex_lock_nested(&othercon->sock_mutex, 2);
|
||||
if (!othercon->sock) {
|
||||
newcon->othercon = othercon;
|
||||
othercon->sock = newsock;
|
||||
newsock->sk->sk_user_data = othercon;
|
||||
add_sock(newsock, othercon);
|
||||
addcon = othercon;
|
||||
mutex_unlock(&othercon->sock_mutex);
|
||||
} else {
|
||||
printk("Extra connection from node %d attempted\n", nodeid);
|
||||
ret = -EAGAIN;
|
||||
mutex_unlock(&othercon->sock_mutex);
|
||||
mutex_unlock(&newcon->sock_mutex);
|
||||
goto accept_err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue