Skip to content

Commit 08685dc

Browse files
Michal Kalderongregkh
authored andcommitted
RDMA/qedr: Fix return code if accept is called on a destroyed qp
[ Upstream commit 8a5a10a ] In iWARP, accept could be called after a QP is already destroyed. In this case an error should be returned and not success. Fixes: 82af6d1 ("RDMA/qedr: Fix synchronization methods and memory leaks in qedr") Link: https://lore.kernel.org/r/20200902165741.8355-5-michal.kalderon@marvell.com Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3d5f262 commit 08685dc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/infiniband/hw/qedr/qedr_iw_cm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
736736
struct qedr_dev *dev = ep->dev;
737737
struct qedr_qp *qp;
738738
struct qed_iwarp_accept_in params;
739-
int rc = 0;
739+
int rc;
740740

741741
DP_DEBUG(dev, QEDR_MSG_IWARP, "Accept on qpid=%d\n", conn_param->qpn);
742742

@@ -759,8 +759,10 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
759759
params.ord = conn_param->ord;
760760

761761
if (test_and_set_bit(QEDR_IWARP_CM_WAIT_FOR_CONNECT,
762-
&qp->iwarp_cm_flags))
762+
&qp->iwarp_cm_flags)) {
763+
rc = -EINVAL;
763764
goto err; /* QP already destroyed */
765+
}
764766

765767
rc = dev->ops->iwarp_accept(dev->rdma_ctx, &params);
766768
if (rc) {

0 commit comments

Comments
 (0)