Skip to content

Commit fac20b9

Browse files
committed
rxrpc: Fix use-after-free in rxrpc_put_local()
Fix rxrpc_put_local() to not access local->debug_id after calling atomic_dec_return() as, unless that returned n==0, we no longer have the right to access the object. Fixes: 06d9532 ("rxrpc: Fix read-after-free in rxrpc_queue_local()") Signed-off-by: David Howells <[email protected]>
1 parent 9fbf082 commit fac20b9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/rxrpc/local_object.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,14 @@ void rxrpc_queue_local(struct rxrpc_local *local)
364364
void rxrpc_put_local(struct rxrpc_local *local)
365365
{
366366
const void *here = __builtin_return_address(0);
367+
unsigned int debug_id;
367368
int n;
368369

369370
if (local) {
371+
debug_id = local->debug_id;
372+
370373
n = atomic_dec_return(&local->usage);
371-
trace_rxrpc_local(local->debug_id, rxrpc_local_put, n, here);
374+
trace_rxrpc_local(debug_id, rxrpc_local_put, n, here);
372375

373376
if (n == 0)
374377
call_rcu(&local->rcu, rxrpc_local_rcu);

0 commit comments

Comments
 (0)