All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@nvidia.com>, <linux-rdma@vger.kernel.org>
Cc: Leon Romanovsky <leonro@mellanox.com>
Subject: Re: [PATCH] RDMA/core: Trigger a WARN_ON if the driver causes uobjects to become leaked
Date: Wed, 26 Aug 2020 11:10:18 +0300	[thread overview]
Message-ID: <6cf9106a-7895-4e88-6ea4-b0292ac2c2f8@amazon.com> (raw)
In-Reply-To: <0-v1-b1e0ed400ba9+f7-warn_destroy_ufile_hw_jgg@nvidia.com>

On 25/08/2020 19:35, Jason Gunthorpe wrote:
> Drivers that fail destroy can cause uverbs to leak uobjects. Drivers are
> required to always eventually destroy their ubojects, so trigger a WARN_ON
> to detect this driver bug.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/infiniband/core/rdma_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
> index 3962da54ffbf47..d2b5417a4d5170 100644
> --- a/drivers/infiniband/core/rdma_core.c
> +++ b/drivers/infiniband/core/rdma_core.c
> @@ -895,8 +895,9 @@ void uverbs_destroy_ufile_hw(struct ib_uverbs_file *ufile,
>  		if (__uverbs_cleanup_ufile(ufile, reason)) {
>  			/*
>  			 * No entry was cleaned-up successfully during this
> -			 * iteration
> +			 * iteration. It is a driver bug to fail destruction.
>  			 */
> +			WARN_ON(!list_empty(&ufile->uobjects));
>  			break;
>  		}
>  
> 

Looks good,
Reviewed-by: Gal Pressman <galpress@amazon.com>

  parent reply	other threads:[~2020-08-26  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 16:35 [PATCH] RDMA/core: Trigger a WARN_ON if the driver causes uobjects to become leaked Jason Gunthorpe
2020-08-26  6:37 ` Leon Romanovsky
2020-08-26  8:10 ` Gal Pressman [this message]
2020-08-31 15:26 ` 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=6cf9106a-7895-4e88-6ea4-b0292ac2c2f8@amazon.com \
    --to=galpress@amazon.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@mellanox.com \
    --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.