Skip to content

Commit 601be20

Browse files
rafaelmsoaresmartinkpetersen
authored andcommitted
scsi: qla2xxx: Fix memory leak in __qlt_24xx_handle_abts()
Commit 8f394da ("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() didn't find a command, but it missed to clean up the allocated memory for the management command. Link: https://lore.kernel.org/r/[email protected] Fixes: 8f394da ("scsi: qla2xxx: Drop TARGET_SCF_LOOKUP_LUN_FROM_TAG") Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Rafael Mendonca <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent fbfe968 commit 601be20

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2151,8 +2151,10 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
21512151

21522152
abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess,
21532153
le32_to_cpu(abts->exchange_addr_to_abort));
2154-
if (!abort_cmd)
2154+
if (!abort_cmd) {
2155+
mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool);
21552156
return -EIO;
2157+
}
21562158
mcmd->unpacked_lun = abort_cmd->se_cmd.orig_fe_lun;
21572159

21582160
if (abort_cmd->qpair) {

0 commit comments

Comments
 (0)