Skip to content

Commit b4c94da

Browse files
committed
rxrpc: Fix rxrpc_peer leak in rxrpc_look_up_bundle()
jira LE-1907 Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 commit-author Eiichi Tsukata <[email protected]> commit ca77fba Need to call rxrpc_put_peer() for bundle candidate before kfree() as it holds a ref to rxrpc_peer. [DH: v2: Changed to abstract out the bundle freeing code into a function] Fixes: 245500d ("rxrpc: Rewrite the client connection manager") Signed-off-by: Eiichi Tsukata <[email protected]> Signed-off-by: David Howells <[email protected]> Reviewed-by: Marc Dionne <[email protected]> cc: [email protected] Link: https://lore.kernel.org/r/[email protected]/ # v1 (cherry picked from commit ca77fba) Signed-off-by: Jonathan Maple <[email protected]>
1 parent ac71d5f commit b4c94da

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

net/rxrpc/conn_client.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,20 @@ struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *bundle)
135135
return bundle;
136136
}
137137

138+
static void rxrpc_free_bundle(struct rxrpc_bundle *bundle)
139+
{
140+
rxrpc_put_peer(bundle->params.peer);
141+
kfree(bundle);
142+
}
143+
138144
void rxrpc_put_bundle(struct rxrpc_bundle *bundle)
139145
{
140146
unsigned int d = bundle->debug_id;
141147
unsigned int u = atomic_dec_return(&bundle->usage);
142148

143149
_debug("PUT B=%x %u", d, u);
144-
if (u == 0) {
145-
rxrpc_put_peer(bundle->params.peer);
146-
kfree(bundle);
147-
}
150+
if (u == 0)
151+
rxrpc_free_bundle(bundle);
148152
}
149153

150154
/*
@@ -328,7 +332,7 @@ static struct rxrpc_bundle *rxrpc_look_up_bundle(struct rxrpc_conn_parameters *c
328332
return candidate;
329333

330334
found_bundle_free:
331-
kfree(candidate);
335+
rxrpc_free_bundle(candidate);
332336
found_bundle:
333337
rxrpc_get_bundle(bundle);
334338
spin_unlock(&local->client_bundles_lock);

0 commit comments

Comments
 (0)