mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>, kjlu@umn.edu
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] scsi: scsi_debug: Fix memleak in scsi_debug_init
Date: Sat, 26 Dec 2020 19:46:39 -0500	[thread overview]
Message-ID: <fc129fb4-a255-68cd-92e1-3206ac2b085f@interlog.com> (raw)
In-Reply-To: <20201226061503.20050-1-dinghao.liu@zju.edu.cn>

On 2020-12-26 1:15 a.m., Dinghao Liu wrote:
> When sdeb_zbc_model does not match BLK_ZONED_NONE,
> BLK_ZONED_HA or BLK_ZONED_HM, we should free sdebug_q_arr
> to prevent memleak. Also there is no need to execute
> sdebug_erase_store() on failure of sdeb_zbc_model_str().
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Acked-by: Douglas Gilbert <dgilbert@interlog.com>

Thanks.

> ---
> 
> Changelog:
> 
> v2: - Add missed assignment statement for ret.
> ---
>   drivers/scsi/scsi_debug.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 24c0f7ec0351..4a08c450b756 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -6740,7 +6740,7 @@ static int __init scsi_debug_init(void)
>   		k = sdeb_zbc_model_str(sdeb_zbc_model_s);
>   		if (k < 0) {
>   			ret = k;
> -			goto free_vm;
> +			goto free_q_arr;
>   		}
>   		sdeb_zbc_model = k;
>   		switch (sdeb_zbc_model) {
> @@ -6753,7 +6753,8 @@ static int __init scsi_debug_init(void)
>   			break;
>   		default:
>   			pr_err("Invalid ZBC model\n");
> -			return -EINVAL;
> +			ret = -EINVAL;
> +			goto free_q_arr;
>   		}
>   	}
>   	if (sdeb_zbc_model != BLK_ZONED_NONE) {
> 


  reply	other threads:[~2020-12-27  0:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26  6:15 Dinghao Liu
2020-12-27  0:46 ` Douglas Gilbert [this message]
2021-01-08  4:19 ` Martin K. Petersen

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=fc129fb4-a255-68cd-92e1-3206ac2b085f@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=dinghao.liu@zju.edu.cn \
    --cc=jejb@linux.ibm.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®