Skip to content

Commit b056327

Browse files
Guoqing Jiangrleon
authored andcommitted
RDMA/siw: Balance the reference of cep->kref in the error path
The siw_connect can go to err in below after cep is allocated successfully: 1. If siw_cm_alloc_work returns failure. In this case socket is not assoicated with cep so siw_cep_put can't be called by siw_socket_disassoc. We need to call siw_cep_put twice since cep->kref is increased once after it was initialized. 2. If siw_cm_queue_work can't find a work, which means siw_cep_get is not called in siw_cm_queue_work, so cep->kref is increased twice by siw_cep_get and when associate socket with cep after it was initialized. So we need to call siw_cep_put three times (one in siw_socket_disassoc). 3. siw_send_mpareqrep returns error, this scenario is similar as 2. So we need to remove one siw_cep_put in the error path. Fixes: 6c52fdc ("rdma/siw: connection management") Signed-off-by: Guoqing Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Bernard Metzler <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent dfe2611 commit b056327

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/infiniband/sw/siw/siw_cm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
15011501

15021502
cep->cm_id = NULL;
15031503
id->rem_ref(id);
1504-
siw_cep_put(cep);
15051504

15061505
qp->cep = NULL;
15071506
siw_cep_put(cep);

0 commit comments

Comments
 (0)