From: Joy Gu <jgu@purestorage.com>
To: linux-scsi@vger.kernel.org
Cc: njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com,
bvanassche@acm.org, Joy Gu <jgu@purestorage.com>
Subject: [PATCH 1/2] scsi: qla2xxx: Fix a memory leak in an error path of qla2x00_process_els()
Date: Tue, 12 Oct 2021 12:18:33 -0700 [thread overview]
Message-ID: <20211012191834.90306-2-jgu@purestorage.com> (raw)
In-Reply-To: <20211012191834.90306-1-jgu@purestorage.com>
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.
Fixes: 8c0eb596baa5 ("[SCSI] qla2xxx: Fix a memory leak in an error path of qla2x00_process_els()")
Signed-off-by: Joy Gu <jgu@purestorage.com>
---
drivers/scsi/qla2xxx/qla_bsg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 4b5d28d89d69..655cf5de604b 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -431,7 +431,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
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;
--
2.17.1
next prev parent reply other threads:[~2021-10-12 19:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 19:18 [PATCH 0/2] scsi: qla2xxx: Fix bugs found by CodeSonar Joy Gu
2021-10-12 19:18 ` Joy Gu [this message]
2021-10-12 20:29 ` [PATCH 1/2] scsi: qla2xxx: Fix a memory leak in an error path of qla2x00_process_els() Bart Van Assche
2021-10-12 19:18 ` [PATCH 2/2] scsi: qla2xxx: Initialize uninitialized variables Joy Gu
2021-10-19 3:43 ` [PATCH 0/2] scsi: qla2xxx: Fix bugs found by CodeSonar 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=20211012191834.90306-2-jgu@purestorage.com \
--to=jgu@purestorage.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=njavali@marvell.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