From: Leon Romanovsky <leon@kernel.org>
To: Md Haris Iqbal <haris.iqbal@ionos.com>
Cc: linux-rdma@vger.kernel.org, bvanassche@acm.org, jgg@ziepe.ca,
jinpu.wang@ionos.com, linmq006@gmail.com,
Gioh Kim <gi-oh.kim@ionos.com>,
Santosh Kumar Pradhan <santosh.pradhan@ionos.com>
Subject: Re: [PATCH v2] RDMA/rtrs-clt: Fix possible double free in error case
Date: Sun, 23 Jan 2022 12:56:49 +0200 [thread overview]
Message-ID: <Ye00cQ+VUkzh8JCH@unreal> (raw)
In-Reply-To: <20220120173632.420807-1-haris.iqbal@ionos.com>
On Thu, Jan 20, 2022 at 06:36:32PM +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.
>
> free clt->pcpu_path and clt explicitly when dev_set_name fails.
> For other errors after that, let the release function take care of
> freeing them. Also remove free_percpu(clt->pcpu_path) from free_clt()
>
> Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
> Reported-by: Miaoqian Lin <linmq006@gmail.com>
> Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
> Reviewed-by: Gioh Kim <gi-oh.kim@ionos.com>
> Reviewed-by: Santosh Kumar Pradhan <santosh.pradhan@ionos.com>
> Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
> ---
> Changes since v1:
> - Explicitly free clt->pcpu_path and clt when dev_set_name fails
> - Remove free_percpu(clt->pcpu_path) from free_clt function
>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-clt.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
prev parent reply other threads:[~2022-01-23 10:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 17:36 [PATCH v2] RDMA/rtrs-clt: Fix possible double free in error case Md Haris Iqbal
2022-01-23 10:56 ` 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=Ye00cQ+VUkzh8JCH@unreal \
--to=leon@kernel.org \
--cc=bvanassche@acm.org \
--cc=gi-oh.kim@ionos.com \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=linmq006@gmail.com \
--cc=linux-rdma@vger.kernel.org \
--cc=santosh.pradhan@ionos.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox