All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshu Madhani <himanshu.madhani@oracle.com>
To: Rafael Mendonca <rafaelmendsr@gmail.com>
Cc: Nilesh Javali <njavali@marvell.com>,
	GR-QLogic-Storage-Upstream
	<GR-QLogic-Storage-Upstream@marvell.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	Martin Petersen <martin.petersen@oracle.com>,
	Michael Christie <michael.christie@oracle.com>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts()
Date: Wed, 14 Sep 2022 16:23:28 +0000	[thread overview]
Message-ID: <4E653C94-D457-4881-BAAC-35EA5DC178D8@oracle.com> (raw)
In-Reply-To: <20220914024924.695604-1-rafaelmendsr@gmail.com>



> On Sep 13, 2022, at 7:49 PM, Rafael Mendonca <rafaelmendsr@gmail.com> wrote:
> 
> Commit 8f394da36a36 ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG")
> made the __qlt_24xx_handle_abts() function return early if
> tcm_qla2xxx_find_cmd_by_tag() doesn't find a command, but it missed to
> clean up the allocated memory for the management command in such a case.
> 
> Fixes: 8f394da36a36 ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG")
> Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
> ---
> drivers/scsi/qla2xxx/qla_target.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 62666df1a59e..4acff4e84b90 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -2151,8 +2151,10 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
> 
> 	abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess,
> 				le32_to_cpu(abts->exchange_addr_to_abort));
> -	if (!abort_cmd)
> +	if (!abort_cmd) {
> +		mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool);
> 		return -EIO;
> +	}
> 	mcmd->unpacked_lun = abort_cmd->se_cmd.orig_fe_lun;
> 
> 	if (abort_cmd->qpair) {
> -- 
> 2.34.1
> 
Looks Good.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

-- 
Himanshu Madhani	Oracle Linux Engineering


  reply	other threads:[~2022-09-14 16:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  2:49 [PATCH] scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts() Rafael Mendonca
2022-09-14 16:23 ` Himanshu Madhani [this message]
2022-09-16  3:01 ` 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=4E653C94-D457-4881-BAAC-35EA5DC178D8@oracle.com \
    --to=himanshu.madhani@oracle.com \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=njavali@marvell.com \
    --cc=rafaelmendsr@gmail.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 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.