Skip to content

Commit

Permalink
rxrpc: Fix NULL deref in rxrpc_unuse_local()
Browse files Browse the repository at this point in the history
Fix rxrpc_unuse_local() to get the debug_id *after* checking to see if
local is NULL.

Fixes: a2cf326 ("rxrpc: Fold __rxrpc_unuse_local() into rxrpc_unuse_local()")
Reported-by: syzbot+3538a6a72efa8b059c38@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: syzbot+3538a6a72efa8b059c38@syzkaller.appspotmail.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Howells authored and David S. Miller committed Dec 19, 2022
1 parent fdb9948 commit eaa0239
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/rxrpc/local_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,11 @@ struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *local,
*/
void rxrpc_unuse_local(struct rxrpc_local *local, enum rxrpc_local_trace why)
{
unsigned int debug_id = local->debug_id;
unsigned int debug_id;
int r, u;

if (local) {
debug_id = local->debug_id;
r = refcount_read(&local->ref);
u = atomic_dec_return(&local->active_users);
trace_rxrpc_local(debug_id, why, r, u);
Expand Down

0 comments on commit eaa0239

Please sign in to comment.