All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kalderon <michal.kalderon@marvell.com>
To: <mkalderon@marvell.com>, <aelior@marvell.com>,
	<dledford@redhat.com>, <jgg@ziepe.ca>, <davem@davemloft.net>
Cc: <linux-rdma@vger.kernel.org>, <netdev@vger.kernel.org>,
	Michal Kalderon <michal.kalderon@marvell.com>
Subject: [PATCH rdma-next 4/8] RDMA/qedr: Fix return code if accept is called on a destroyed qp
Date: Wed, 2 Sep 2020 19:57:37 +0300	[thread overview]
Message-ID: <20200902165741.8355-5-michal.kalderon@marvell.com> (raw)
In-Reply-To: <20200902165741.8355-1-michal.kalderon@marvell.com>

In iWARP, accept could be called after a QP is already destroyed.
In this case an error should be returned and not success.

Fixes: 82af6d19d8d9 ("RDMA/qedr: Fix synchronization methods and memory leaks in qedr")
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
---
 drivers/infiniband/hw/qedr/qedr_iw_cm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/qedr_iw_cm.c b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
index 97fc7dd353b0..c7169d2c69e5 100644
--- a/drivers/infiniband/hw/qedr/qedr_iw_cm.c
+++ b/drivers/infiniband/hw/qedr/qedr_iw_cm.c
@@ -736,7 +736,7 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	struct qedr_dev *dev = ep->dev;
 	struct qedr_qp *qp;
 	struct qed_iwarp_accept_in params;
-	int rc = 0;
+	int rc;
 
 	DP_DEBUG(dev, QEDR_MSG_IWARP, "Accept on qpid=%d\n", conn_param->qpn);
 
@@ -759,8 +759,10 @@ int qedr_iw_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
 	params.ord = conn_param->ord;
 
 	if (test_and_set_bit(QEDR_IWARP_CM_WAIT_FOR_CONNECT,
-			     &qp->iwarp_cm_flags))
+			     &qp->iwarp_cm_flags)) {
+		rc = -EINVAL;
 		goto err; /* QP already destroyed */
+	}
 
 	rc = dev->ops->iwarp_accept(dev->rdma_ctx, &params);
 	if (rc) {
-- 
2.14.5


  parent reply	other threads:[~2020-09-02 16:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 16:57 [PATCH rdma-next 0/8] RDMA/qedr: various fixes Michal Kalderon
2020-09-02 16:57 ` [PATCH rdma-next 1/8] RDMA/qedr: Fix qp structure memory leak Michal Kalderon
2020-09-02 16:57 ` [PATCH rdma-next 2/8] RDMA/qedr: Fix doorbell setting Michal Kalderon
2020-09-02 16:57 ` [PATCH rdma-next 3/8] RDMA/qedr: Fix use of uninitialized field Michal Kalderon
2020-09-02 16:57 ` Michal Kalderon [this message]
2020-09-02 16:57 ` [PATCH rdma-next 5/8] qede: Notify qedr when mtu has changed Michal Kalderon
2020-09-02 16:57 ` [PATCH rdma-next 6/8] RDMA/qedr: Fix iWARP active mtu display Michal Kalderon
2020-09-02 16:57 ` [PATCH rdma-next 7/8] RDMA/qedr: Fix inline size returned for iWARP Michal Kalderon
2020-09-02 16:57 ` [PATCH rdma-next 8/8] RDMA/qedr: Fix function prototype parameters alignment Michal Kalderon
2020-09-09 19:15 ` [PATCH rdma-next 0/8] RDMA/qedr: various fixes Jason Gunthorpe
2020-09-10  6:29   ` [EXT] " Michal Kalderon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200902165741.8355-5-michal.kalderon@marvell.com \
    --to=michal.kalderon@marvell.com \
    --cc=aelior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mkalderon@marvell.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.