All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Md Haris Iqbal <haris.iqbal@ionos.com>
Cc: linux-rdma@vger.kernel.org, bvanassche@acm.org, leon@kernel.org,
	jinpu.wang@ionos.com, Miaoqian Lin <linmq006@gmail.com>
Subject: Re: [PATCH v4 1/2] RDMA/rtrs-clt: Fix possible double free in error case
Date: Fri, 18 Feb 2022 14:15:07 -0400	[thread overview]
Message-ID: <20220218181507.GA1668864@nvidia.com> (raw)
In-Reply-To: <20220217030929.323849-1-haris.iqbal@ionos.com>

On Thu, Feb 17, 2022 at 04:09:28AM +0100, Md Haris Iqbal wrote:
> Callback function rtrs_clt_dev_release() for put_device() calls kfree(clt)
> to free memory. We shouldn't call kfree(clt) again, and we can't use the
> clt after kfree too.
> 
> Replace device_register with device_initialize and device_add so that
> dev_set_name can be used appropriately.
> 
> Move mutex_destroy to release function so it can be called in alloc_clt err
> path.
> 
> Fixes: eab098246625 ("RDMA/rtrs-clt: Refactor the failure cases in alloc_clt")
> Reported-by: Miaoqian Lin <linmq006@gmail.com>
> Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
> Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
> ---
> v3>v4:
> 	Add Fixes line
> v2>v3
> 	Fix dev_set_name
> v1>v2:
> 	Free clt->pcpu_path
> 
>  drivers/infiniband/ulp/rtrs/rtrs-clt.c | 37 ++++++++++++++------------
>  1 file changed, 20 insertions(+), 17 deletions(-)

Applied to for-rc, thanks

Jason

      parent reply	other threads:[~2022-02-18 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  3:09 [PATCH v4 1/2] RDMA/rtrs-clt: Fix possible double free in error case Md Haris Iqbal
2022-02-17  3:09 ` [PATCH v2 2/2] RDMA/rtrs-clt: Move free_permit from free_clt to rtrs_clt_close Md Haris Iqbal
2022-02-18 18:15 ` Jason Gunthorpe [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=20220218181507.GA1668864@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=bvanassche@acm.org \
    --cc=haris.iqbal@ionos.com \
    --cc=jinpu.wang@ionos.com \
    --cc=leon@kernel.org \
    --cc=linmq006@gmail.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.