net/rds: undo conn_alloc() the same way on every __rds_conn_create() exit
trans->conn_alloc() may allocate transport data for every path of a
multipath connection - rds_tcp_conn_alloc() does - which is why the
lost-creation-race exit of __rds_conn_create() loops over all npaths
when it frees the connection it just built. The passive-connection
exit right above it frees only path 0.
That is not a leak today: a passive twin is only created for an IB
loopback connection (an incoming TCP connect to a local address is
refused with -EOPNOTSUPP before it gets here), and the IB transport is
not multipath, so npaths is 1 on that exit. But the two exits express
the same "undo conn_alloc()" step in two different ways, and the
following patches add another exit of the same kind. Move the loop
into a helper and use it everywhere, so that the step cannot silently
diverge if a multipath transport ever grows a passive twin.
Signed-off-by: Allison Henderson <achender@kernel.org>
Link: https://patch.msgid.link/20261113044355.2932029-2-achender@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 file changed