Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/irdma: Check for null udata during reg_user_mr
@ 2026-06-30 15:47 Jacob Moroni
  2026-07-05 14:09 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Jacob Moroni @ 2026-06-30 15:47 UTC (permalink / raw)
  To: tatyana.e.nikolova, jgg, leon; +Cc: linux-rdma, Jacob Moroni

The irdma driver requires udata for reg_user_mr. Previously,
it was assuming that it was always non-null, but it can actually
be null if the user intentionally triggers the UVERBS_METHOD_REG_MR
ioctl.

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

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index cb54c7c8fcd..3bcac68a612 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -3519,6 +3519,9 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,
 	if (dmah)
 		return ERR_PTR(-EOPNOTSUPP);
 
+	if (!udata)
+		return ERR_PTR(-EINVAL);
+
 	if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size)
 		return ERR_PTR(-EINVAL);
 
-- 
2.55.0.rc0.799.gd6f94ed593-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/irdma: Check for null udata during reg_user_mr
  2026-06-30 15:47 [PATCH] RDMA/irdma: Check for null udata during reg_user_mr Jacob Moroni
@ 2026-07-05 14:09 ` Leon Romanovsky
  2026-07-05 14:22   ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2026-07-05 14:09 UTC (permalink / raw)
  To: Jacob Moroni; +Cc: tatyana.e.nikolova, jgg, linux-rdma

On Tue, Jun 30, 2026 at 03:47:19PM +0000, Jacob Moroni wrote:
> The irdma driver requires udata for reg_user_mr. Previously,
> it was assuming that it was always non-null, but it can actually
> be null if the user intentionally triggers the UVERBS_METHOD_REG_MR
> ioctl.
> 
> Signed-off-by: Jacob Moroni <jmoroni@google.com>
> ---
>  drivers/infiniband/hw/irdma/verbs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> index cb54c7c8fcd..3bcac68a612 100644
> --- a/drivers/infiniband/hw/irdma/verbs.c
> +++ b/drivers/infiniband/hw/irdma/verbs.c
> @@ -3519,6 +3519,9 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,
>  	if (dmah)
>  		return ERR_PTR(-EOPNOTSUPP);
>  
> +	if (!udata)
> +		return ERR_PTR(-EINVAL);

Is this check specific to iRDMA?

Thanks

> +
>  	if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size)
>  		return ERR_PTR(-EINVAL);
>  
> -- 
> 2.55.0.rc0.799.gd6f94ed593-goog
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/irdma: Check for null udata during reg_user_mr
  2026-07-05 14:09 ` Leon Romanovsky
@ 2026-07-05 14:22   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2026-07-05 14:22 UTC (permalink / raw)
  To: Jacob Moroni; +Cc: tatyana.e.nikolova, jgg, linux-rdma

On Sun, Jul 05, 2026 at 05:09:40PM +0300, Leon Romanovsky wrote:
> On Tue, Jun 30, 2026 at 03:47:19PM +0000, Jacob Moroni wrote:
> > The irdma driver requires udata for reg_user_mr. Previously,
> > it was assuming that it was always non-null, but it can actually
> > be null if the user intentionally triggers the UVERBS_METHOD_REG_MR
> > ioctl.
> > 
> > Signed-off-by: Jacob Moroni <jmoroni@google.com>
> > ---
> >  drivers/infiniband/hw/irdma/verbs.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> > index cb54c7c8fcd..3bcac68a612 100644
> > --- a/drivers/infiniband/hw/irdma/verbs.c
> > +++ b/drivers/infiniband/hw/irdma/verbs.c
> > @@ -3519,6 +3519,9 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len,
> >  	if (dmah)
> >  		return ERR_PTR(-EOPNOTSUPP);
> >  
> > +	if (!udata)
> > +		return ERR_PTR(-EINVAL);
> 
> Is this check specific to iRDMA?

Ohh, I see that it is fixed in  011199f46f44 ("RDMA/uverbs: Add
UVERBS_ATTR_UHW to UVERBS_METHOD_REG_MR").

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-05 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 15:47 [PATCH] RDMA/irdma: Check for null udata during reg_user_mr Jacob Moroni
2026-07-05 14:09 ` Leon Romanovsky
2026-07-05 14:22   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox