diff options
Diffstat (limited to 'net/vmw_vsock/af_vsock.c')
-rw-r--r-- | net/vmw_vsock/af_vsock.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index b5f1221f48d4..b96ac918e0ba 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c | |||
@@ -61,6 +61,14 @@ | |||
61 | * function will also cleanup rejected sockets, those that reach the connected | 61 | * function will also cleanup rejected sockets, those that reach the connected |
62 | * state but leave it before they have been accepted. | 62 | * state but leave it before they have been accepted. |
63 | * | 63 | * |
64 | * - Lock ordering for pending or accept queue sockets is: | ||
65 | * | ||
66 | * lock_sock(listener); | ||
67 | * lock_sock_nested(pending, SINGLE_DEPTH_NESTING); | ||
68 | * | ||
69 | * Using explicit nested locking keeps lockdep happy since normally only one | ||
70 | * lock of a given class may be taken at a time. | ||
71 | * | ||
64 | * - Sockets created by user action will be cleaned up when the user process | 72 | * - Sockets created by user action will be cleaned up when the user process |
65 | * calls close(2), causing our release implementation to be called. Our release | 73 | * calls close(2), causing our release implementation to be called. Our release |
66 | * implementation will perform some cleanup then drop the last reference so our | 74 | * implementation will perform some cleanup then drop the last reference so our |
@@ -443,7 +451,7 @@ void vsock_pending_work(struct work_struct *work) | |||
443 | cleanup = true; | 451 | cleanup = true; |
444 | 452 | ||
445 | lock_sock(listener); | 453 | lock_sock(listener); |
446 | lock_sock(sk); | 454 | lock_sock_nested(sk, SINGLE_DEPTH_NESTING); |
447 | 455 | ||
448 | if (vsock_is_pending(sk)) { | 456 | if (vsock_is_pending(sk)) { |
449 | vsock_remove_pending(listener, sk); | 457 | vsock_remove_pending(listener, sk); |
@@ -1292,7 +1300,7 @@ static int vsock_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1292 | if (connected) { | 1300 | if (connected) { |
1293 | listener->sk_ack_backlog--; | 1301 | listener->sk_ack_backlog--; |
1294 | 1302 | ||
1295 | lock_sock(connected); | 1303 | lock_sock_nested(connected, SINGLE_DEPTH_NESTING); |
1296 | vconnected = vsock_sk(connected); | 1304 | vconnected = vsock_sk(connected); |
1297 | 1305 | ||
1298 | /* If the listener socket has received an error, then we should | 1306 | /* If the listener socket has received an error, then we should |