Skip to content

Commit b39a934

Browse files
dhowellsdavem330
authored andcommitted
rxrpc: Fix service call disconnection
The recent patch that substituted a flag on an rxrpc_call for the connection pointer being NULL as an indication that a call was disconnected puts the set_bit in the wrong place for service calls. This is only a problem if a call is implicitly terminated by a new call coming in on the same connection channel instead of a terminating ACK packet. In such a case, rxrpc_input_implicit_end_call() calls __rxrpc_disconnect_call(), which is now (incorrectly) setting the disconnection bit, meaning that when rxrpc_release_call() is later called, it doesn't call rxrpc_disconnect_call() and so the call isn't removed from the peer's error distribution list and the list gets corrupted. KASAN finds the issue as an access after release on a call, but the position at which it occurs is confusing as it appears to be related to a different call (the call site is where the latter call is being removed from the error distribution list and either the next or pprev pointer points to a previously released call). Fix this by moving the setting of the flag from __rxrpc_disconnect_call() to rxrpc_disconnect_call() in the same place that the connection pointer was being cleared. Fixes: 5273a19 ("rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect") Signed-off-by: David Howells <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f798a5a commit b39a934

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/rxrpc/conn_object.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ void __rxrpc_disconnect_call(struct rxrpc_connection *conn,
171171

172172
_enter("%d,%x", conn->debug_id, call->cid);
173173

174-
set_bit(RXRPC_CALL_DISCONNECTED, &call->flags);
175-
176174
if (rcu_access_pointer(chan->call) == call) {
177175
/* Save the result of the call so that we can repeat it if necessary
178176
* through the channel, whilst disposing of the actual call record.
@@ -225,6 +223,7 @@ void rxrpc_disconnect_call(struct rxrpc_call *call)
225223
__rxrpc_disconnect_call(conn, call);
226224
spin_unlock(&conn->channel_lock);
227225

226+
set_bit(RXRPC_CALL_DISCONNECTED, &call->flags);
228227
conn->idle_timestamp = jiffies;
229228
}
230229

0 commit comments

Comments
 (0)