Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jacob Moroni <jmoroni@google.com>
To: tatyana.e.nikolova@intel.com, jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, Jacob Moroni <jmoroni@google.com>
Subject: [PATCH rdma-next v2 3/5] RDMA/irdma: Use ib_respond_empty_udata where applicable
Date: Mon, 29 Jun 2026 23:25:30 +0000	[thread overview]
Message-ID: <20260629232532.2057423-4-jmoroni@google.com> (raw)
In-Reply-To: <20260629232532.2057423-1-jmoroni@google.com>

Methods that do not provide any user response should use
the ib_respond_empty_udata() helper to ensure that user
response buffers are cleared.

Signed-off-by: Jacob Moroni <jmoroni@google.com>
---
 drivers/infiniband/hw/irdma/verbs.c | 51 ++++++++++++++++++++++++-----
 1 file changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 074dfa46b35c..c1df9ca1b86b 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -455,6 +455,10 @@ static int irdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
 	if (err)
 		return err;
 
+	err = ib_respond_empty_udata(udata);
+	if (err)
+		return err;
+
 	irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_pds, iwpd->sc_pd.pd_id);
 
 	return 0;
@@ -557,6 +561,10 @@ static int irdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
 	if (err)
 		return err;
 
+	err = ib_respond_empty_udata(udata);
+	if (err)
+		return err;
+
 	iwqp->sc_qp.qp_uk.destroy_pending = true;
 
 	if (iwqp->iwarp_state >= IRDMA_QP_STATE_IDLE)
@@ -1626,14 +1634,14 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 				uresp.push_offset = iwqp->sc_qp.push_offset;
 			}
 			ret = ib_respond_udata(udata, uresp);
-			if (ret) {
+			if (ret)
 				irdma_remove_push_mmap_entries(iwqp);
-				return ret;
-			}
+			return ret;
+
 		}
 	}
 
-	return 0;
+	return ib_respond_empty_udata(udata);
 exit:
 	spin_unlock_irqrestore(&iwqp->lock, flags);
 
@@ -1872,13 +1880,12 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
 		}
 
 		err = ib_respond_udata(udata, uresp);
-		if (err) {
+		if (err)
 			irdma_remove_push_mmap_entries(iwqp);
-			return err;
-		}
+		return err;
 	}
 
-	return 0;
+	return ib_respond_empty_udata(udata);
 exit:
 	spin_unlock_irqrestore(&iwqp->lock, flags);
 
@@ -1982,6 +1989,10 @@ static int irdma_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)
 	if (err)
 		return err;
 
+	err = ib_respond_empty_udata(udata);
+	if (err)
+		return err;
+
 	irdma_srq_wq_destroy(iwdev->rf, srq);
 	irdma_srq_free_rsrc(iwdev->rf, iwsrq);
 	return 0;
@@ -2007,6 +2018,10 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata)
 	if (err)
 		return err;
 
+	err = ib_respond_empty_udata(udata);
+	if (err)
+		return err;
+
 	spin_lock_irqsave(&iwcq->lock, flags);
 	if (!list_empty(&iwcq->cmpl_generated))
 		irdma_remove_cmpls_list(iwcq);
@@ -2052,6 +2067,10 @@ static int irdma_resize_cq(struct ib_cq *ibcq, unsigned int entries,
 	u8 cqe_size;
 	int ret;
 
+	ret = ib_respond_empty_udata(udata);
+	if (ret)
+		return ret;
+
 	iwdev = to_iwdev(ibcq->device);
 	rf = iwdev->rf;
 
@@ -2222,6 +2241,10 @@ static int irdma_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
 	if (status)
 		return status;
 
+	status = ib_respond_empty_udata(udata);
+	if (status)
+		return status;
+
 	if (attr_mask & IB_SRQ_MAX_WR)
 		return -EINVAL;
 
@@ -3063,6 +3086,10 @@ static int irdma_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata)
 	if (err_code)
 		return err_code;
 
+	err_code = ib_respond_empty_udata(udata);
+	if (err_code)
+		return err_code;
+
 	stag = irdma_create_stag(iwdev);
 	if (!stag)
 		return -ENOMEM;
@@ -4006,6 +4033,10 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata)
 	if (ret)
 		return ret;
 
+	ret = ib_respond_empty_udata(udata);
+	if (ret)
+		return ret;
+
 	if (iwmr->type != IRDMA_MEMREG_TYPE_MEM) {
 		if (iwmr->region) {
 			struct irdma_ucontext *ucontext;
@@ -5381,6 +5412,10 @@ static int irdma_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *attr,
 	if (err)
 		return err;
 
+	err = ib_respond_empty_udata(udata);
+	if (err)
+		return err;
+
 	err = irdma_setup_ah(ibah, attr);
 	if (err)
 		return err;
-- 
2.55.0.rc0.799.gd6f94ed593-goog


  parent reply	other threads:[~2026-06-29 23:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 23:25 [PATCH rdma-next v2 0/5] RDMA/irdma: Adopt robust udata Jacob Moroni
2026-06-29 23:25 ` [PATCH rdma-next v2 1/5] RDMA/irdma: Enforce empty udata input for no-input ops Jacob Moroni
2026-06-29 23:25 ` [PATCH rdma-next v2 2/5] RDMA/irdma: Use robust udata input copy helpers Jacob Moroni
2026-06-29 23:25 ` Jacob Moroni [this message]
2026-06-29 23:25 ` [PATCH rdma-next v2 4/5] RDMA/irdma: Use robust udata helper for QP creation Jacob Moroni
2026-06-29 23:25 ` [PATCH rdma-next v2 5/5] RDMA/irdma: Enable uverbs_robust_udata compliance flag Jacob Moroni
2026-06-30 17:23 ` [PATCH rdma-next v2 0/5] RDMA/irdma: Adopt robust udata Jacob Moroni
2026-06-30 19:18   ` Jason Gunthorpe

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=20260629232532.2057423-4-jmoroni@google.com \
    --to=jmoroni@google.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=tatyana.e.nikolova@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox