rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect
[ Upstream commit5273a191dc] When a call is disconnected, the connection pointer from the call is cleared to make sure it isn't used again and to prevent further attempted transmission for the call. Unfortunately, there might be a daemon trying to use it at the same time to transmit a packet. Fix this by keeping call->conn set, but setting a flag on the call to indicate disconnection instead. Remove also the bits in the transmission functions where the conn pointer is checked and a ref taken under spinlock as this is now redundant. Fixes:8d94aa381d("rxrpc: Calls shouldn't hold socket refs") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
843e115de4
commit
269a3c472a
@@ -785,6 +785,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call)
|
||||
u32 cid;
|
||||
|
||||
spin_lock(&conn->channel_lock);
|
||||
set_bit(RXRPC_CALL_DISCONNECTED, &call->flags);
|
||||
|
||||
cid = call->cid;
|
||||
if (cid) {
|
||||
@@ -792,7 +793,6 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call)
|
||||
chan = &conn->channels[channel];
|
||||
}
|
||||
trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect);
|
||||
call->conn = NULL;
|
||||
|
||||
/* Calls that have never actually been assigned a channel can simply be
|
||||
* discarded. If the conn didn't get used either, it will follow
|
||||
@@ -908,7 +908,6 @@ out:
|
||||
spin_unlock(&rxnet->client_conn_cache_lock);
|
||||
out_2:
|
||||
spin_unlock(&conn->channel_lock);
|
||||
rxrpc_put_connection(conn);
|
||||
_leave("");
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user