All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Doug Ledford <dledford@redhat.com>
Cc: <linux-rdma@vger.kernel.org>, Gal Pressman <galpress@amazon.com>
Subject: [PATCH for-next 1/2] RDMA/core: Check .create_ah is not NULL only in case it's needed
Date: Sun, 15 Nov 2020 12:34:02 +0200	[thread overview]
Message-ID: <20201115103404.48829-2-galpress@amazon.com> (raw)
In-Reply-To: <20201115103404.48829-1-galpress@amazon.com>

Drivers now expose two callbacks for address handle creation, one for
uverbs and one for kverbs. The function pointer NULL check in
_rdma_create_ah() should only happen if !udata.

A NULL check for .create_user_ah is not needed as it is validated by the
uverbs uapi definitions.

Fixes: 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/core/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index ab1e6048685e..33778f8674a1 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -516,7 +516,7 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
 
 	might_sleep_if(flags & RDMA_CREATE_AH_SLEEPABLE);
 
-	if (!device->ops.create_ah)
+	if (!udata && !device->ops.create_ah)
 		return ERR_PTR(-EOPNOTSUPP);
 
 	ah = rdma_zalloc_drv_obj_gfp(
-- 
2.29.2


  reply	other threads:[~2020-11-15 10:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 10:34 [PATCH for-next 0/2] create_user_ah introduction fixups Gal Pressman
2020-11-15 10:34 ` Gal Pressman [this message]
2020-11-15 11:15   ` [PATCH for-next 1/2] RDMA/core: Check .create_ah is not NULL only in case it's needed Leon Romanovsky
2020-11-16 18:22   ` Jason Gunthorpe
2020-11-16 18:32     ` Gal Pressman
2020-11-15 10:34 ` [PATCH for-next 2/2] RDMA/efa: Remove .create_ah callback assignment Gal Pressman
2020-11-15 11:15   ` Leon Romanovsky
2020-11-16 20:52 ` [PATCH for-next 0/2] create_user_ah introduction fixups 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=20201115103404.48829-2-galpress@amazon.com \
    --to=galpress@amazon.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@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.