All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Danila Chernetsov <listdansp@mail.ru>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: Re: [PATCH] RDMA/core: Add error handling in rdma_user_mmap_disassociate.
Date: Thu, 15 Jan 2026 12:36:50 +0200	[thread overview]
Message-ID: <20260115103650.GC14359@unreal> (raw)
In-Reply-To: <20260114205324.136273-1-listdansp@mail.ru>

On Wed, Jan 14, 2026 at 08:53:24PM +0000, Danila Chernetsov wrote:
> rdma_user_mmap_disassociate can be called before
> ib_set_client_data(device, &uverbs_client, uverbs_dev);

It is not.

Thanks

> and cause an error when calling ib_get_client_data.
> Also, consider checking the result of ib_get_client_data to handle errors
>  in other functions.
> 
> Fixes: 51976c6cd786 ("RDMA/core: Provide rdma_user_mmap_disassociate() to disassociate mmap pages")
> Signed-off-by: Danila Chernetsov <listdansp@mail.ru>
> ---
>  drivers/infiniband/core/uverbs_main.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
> index 973fe2c7ef53..a8a2d87f4d3e 100644
> --- a/drivers/infiniband/core/uverbs_main.c
> +++ b/drivers/infiniband/core/uverbs_main.c
> @@ -901,10 +901,12 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile)
>   * This function should be called by drivers that need to disable mmaps for the
>   * device, for instance because it is going to be reset.
>   */
> -void rdma_user_mmap_disassociate(struct ib_device *device)
> +int rdma_user_mmap_disassociate(struct ib_device *device)
>  {
>  	struct ib_uverbs_device *uverbs_dev =
>  		ib_get_client_data(device, &uverbs_client);
> +	if (!uverbs_dev)
> +		return -ENODEV;
>  	struct ib_uverbs_file *ufile;
>  
>  	mutex_lock(&uverbs_dev->lists_mutex);
> @@ -913,6 +915,7 @@ void rdma_user_mmap_disassociate(struct ib_device *device)
>  			uverbs_user_mmap_disassociate(ufile);
>  	}
>  	mutex_unlock(&uverbs_dev->lists_mutex);
> +	return 0;
>  }
>  EXPORT_SYMBOL(rdma_user_mmap_disassociate);
>  
> -- 
> 2.25.1
> 
> 

      reply	other threads:[~2026-01-15 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 20:53 [PATCH] RDMA/core: Add error handling in rdma_user_mmap_disassociate Danila Chernetsov
2026-01-15 10:36 ` Leon Romanovsky [this message]

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=20260115103650.GC14359@unreal \
    --to=leon@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=listdansp@mail.ru \
    --cc=lvc-project@linuxtesting.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.