rxrpc: Use call->peer rather than call->conn->params.peer
authorDavid Howells <dhowells@redhat.com>
Wed, 7 Sep 2016 13:45:26 +0000 (14:45 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 7 Sep 2016 14:30:22 +0000 (15:30 +0100)
Use call->peer rather than call->conn->params.peer to avoid the possibility
of call->conn being NULL and, whilst we're at it, check it for NULL before we
access it.

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

index 3166b52224350fc7eba126a4da0a697da2de0790..060ddc32a85ea1e1dd21d0cdb847a8bb962edd11 100644 (file)
@@ -514,9 +514,11 @@ void rxrpc_release_call(struct rxrpc_call *call)
         */
        _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn);
 
-       spin_lock(&conn->params.peer->lock);
-       hlist_del_init(&call->error_link);
-       spin_unlock(&conn->params.peer->lock);
+       if (call->peer) {
+               spin_lock(&call->peer->lock);
+               hlist_del_init(&call->error_link);
+               spin_unlock(&call->peer->lock);
+       }
 
        write_lock_bh(&rx->call_lock);
        if (!list_empty(&call->accept_link)) {