public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	"hare@suse.de" <hare@suse.de>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
	"hch@lst.de" <hch@lst.de>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH 1/2] nvme-core: fix memory leak in dhchap_secret_store
Date: Thu, 27 Apr 2023 08:32:58 +0000	[thread overview]
Message-ID: <ea0dd98d-8588-674b-e655-41f75591f14c@nvidia.com> (raw)
In-Reply-To: <b0d4b552-4ed2-9338-b567-c23507b266a4@grimberg.me>

On 4/27/23 01:09, Sagi Grimberg wrote:
> Needs a fixes tag
>
> On 4/27/23 11:04, Chaitanya Kulkarni wrote:
>> Free dhchap_secret in nvme_ctrl_dhchap_secret_store() before we return
>> when nvme_auth_generate_key() returns error.
>>
>> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
>> ---
>>   drivers/nvme/host/core.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index 518c759346f0..5a9d97c0c0c1 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -3814,8 +3814,10 @@ static ssize_t 
>> nvme_ctrl_dhchap_secret_store(struct device *dev,
>>           int ret;
>>             ret = nvme_auth_generate_key(dhchap_secret, &key);
>> -        if (ret)
>> +        if (ret) {
>> +            kfree(dhchap_secret);
>>               return ret;
>> +        }
>>           kfree(opts->dhchap_secret);
>>           opts->dhchap_secret = dhchap_secret;
>>           host_key = ctrl->host_key;
>
> Other than that, for this and the next one:
>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

thanks I'll send out V2 with fixes and reviewed-by tag.

-ck



  reply	other threads:[~2023-04-27  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27  8:04 [PATCH 1/2] nvme-core: fix memory leak in dhchap_secret_store Chaitanya Kulkarni
2023-04-27  8:04 ` [PATCH 2/2] nvme-core: fix memory leak in dhchap_ctrl_secret Chaitanya Kulkarni
2023-04-27  8:09 ` [PATCH 1/2] nvme-core: fix memory leak in dhchap_secret_store Sagi Grimberg
2023-04-27  8:32   ` Chaitanya Kulkarni [this message]
2023-04-27 12:32 ` Max Gurtovoy

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=ea0dd98d-8588-674b-e655-41f75591f14c@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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