rxrpc: When clearing a socket, clear the call sets in the right order
authorDavid Howells <dhowells@redhat.com>
Tue, 23 Aug 2016 14:27:24 +0000 (15:27 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 23 Aug 2016 14:27:24 +0000 (15:27 +0100)
When clearing a socket, we should clear the securing-in-progress list
first, then the accept queue and last the main call tree because that's the
order in which a call progresses.  Not that a call should move from the
accept queue to the main tree whilst we're shutting down a socket, but it a
call could possibly move from sequreq to acceptq whilst we're clearing up.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/call_object.c

index 5007e7ac889f358c09660b49d13803c86677bb3e..008188103fd672375a91d2c8385a4c64027c18ac 100644 (file)
@@ -564,12 +564,6 @@ void rxrpc_release_calls_on_socket(struct rxrpc_sock *rx)
 
        read_lock_bh(&rx->call_lock);
 
-       /* mark all the calls as no longer wanting incoming packets */
-       for (p = rb_first(&rx->calls); p; p = rb_next(p)) {
-               call = rb_entry(p, struct rxrpc_call, sock_node);
-               rxrpc_mark_call_released(call);
-       }
-
        /* kill the not-yet-accepted incoming calls */
        list_for_each_entry(call, &rx->secureq, accept_link) {
                rxrpc_mark_call_released(call);
@@ -579,6 +573,12 @@ void rxrpc_release_calls_on_socket(struct rxrpc_sock *rx)
                rxrpc_mark_call_released(call);
        }
 
+       /* mark all the calls as no longer wanting incoming packets */
+       for (p = rb_first(&rx->calls); p; p = rb_next(p)) {
+               call = rb_entry(p, struct rxrpc_call, sock_node);
+               rxrpc_mark_call_released(call);
+       }
+
        read_unlock_bh(&rx->call_lock);
        _leave("");
 }