From: Mauro Matteo Cascella <mcascell@redhat.com>
To: qemu-devel@nongnu.org
Cc: cwmyung@snu.ac.kr, hare@suse.com, mcascell@redhat.com,
qemu-block@nongnu.org
Subject: [PATCH] hw/scsi/megasas: check for NULL frame in megasas_command_cancelled()
Date: Thu, 24 Dec 2020 18:54:41 +0100 [thread overview]
Message-ID: <20201224175441.67538-1-mcascell@redhat.com> (raw)
Ensure that 'cmd->frame' is not NULL before accessing the 'header' field.
This check prevents a potential NULL pointer dereference issue.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1910346
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reported-by: Cheolwoo Myung <cwmyung@snu.ac.kr>
---
hw/scsi/megasas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 1a5fc5857d..77510e120c 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -1893,7 +1893,7 @@ static void megasas_command_cancelled(SCSIRequest *req)
{
MegasasCmd *cmd = req->hba_private;
- if (!cmd) {
+ if (!cmd || !cmd->frame) {
return;
}
cmd->frame->header.cmd_status = MFI_STAT_SCSI_IO_FAILED;
--
2.29.2
next reply other threads:[~2020-12-24 17:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-24 17:54 Mauro Matteo Cascella [this message]
2021-01-13 5:45 ` [PATCH] hw/scsi/megasas: check for NULL frame in megasas_command_cancelled() Alexander Bulekov
2021-01-25 14:22 ` Mauro Matteo Cascella
2021-01-25 14:52 ` Philippe Mathieu-Daudé
2021-01-26 8:36 ` Mauro Matteo Cascella
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=20201224175441.67538-1-mcascell@redhat.com \
--to=mcascell@redhat.com \
--cc=cwmyung@snu.ac.kr \
--cc=hare@suse.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).