aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoy Gu <jgu@purestorage.com>2021-10-12 12:18:33 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-27 09:59:53 +0200
commita7fbb56e6c941d9f59437b96412a348e66388d3e (patch)
tree6b1f90423e895879adb8d1b9317185b088c2b84e
parentc8c1b2183fb8daedf6df77424e6f2869bb0632dc (diff)
downloadlinux-yocto-a7fbb56e6c941d9f59437b96412a348e66388d3e.tar.gz
linux-yocto-a7fbb56e6c941d9f59437b96412a348e66388d3e.tar.bz2
linux-yocto-a7fbb56e6c941d9f59437b96412a348e66388d3e.zip
scsi: qla2xxx: Fix a memory leak in an error path of qla2x00_process_els()
[ Upstream commit 7fb223d0ad801f633c78cbe42b1d1b55f5d163ad ] Commit 8c0eb596baa5 ("[SCSI] qla2xxx: Fix a memory leak in an error path of qla2x00_process_els()"), intended to change: bsg_job->request->msgcode == FC_BSG_HST_ELS_NOLOGIN to: bsg_job->request->msgcode != FC_BSG_RPT_ELS but changed it to: bsg_job->request->msgcode == FC_BSG_RPT_ELS instead. Change the == to a != to avoid leaking the fcport structure or freeing unallocated memory. Link: https://lore.kernel.org/r/20211012191834.90306-2-jgu@purestorage.com Fixes: 8c0eb596baa5 ("[SCSI] qla2xxx: Fix a memory leak in an error path of qla2x00_process_els()") Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Joy Gu <jgu@purestorage.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index d42b2ad84049..2304f54fdc93 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -415,7 +415,7 @@ done_unmap_sg:
goto done_free_fcport;
done_free_fcport:
- if (bsg_request->msgcode == FC_BSG_RPT_ELS)
+ if (bsg_request->msgcode != FC_BSG_RPT_ELS)
qla2x00_free_fcport(fcport);
done:
return rval;