From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, "Alexander Bulekov" <alxndr@bu.edu>,
"Qiuhao Li" <Qiuhao.Li@outlook.com>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Bandan Das" <bsd@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Hannes Reinecke" <hare@suse.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH-for-6.2 1/2] hw/scsi/megasas: Fails command if SGL buffer overflows
Date: Fri, 19 Nov 2021 21:11:40 +0100 [thread overview]
Message-ID: <20211119201141.532377-2-philmd@redhat.com> (raw)
In-Reply-To: <20211119201141.532377-1-philmd@redhat.com>
If we detect an overflow on the SGL buffer, do not
keep processing the command: discard it. TARGET_FAILURE
sense code will be returned (MFI_STAT_SCSI_DONE_WITH_ERROR).
Reported-by: Alexander Bulekov <alxndr@bu.edu>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/521
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
No, I haven't looked at the datasheet.
---
hw/scsi/megasas.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 4ff51221d4c..8f357841004 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -303,6 +303,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
}
if (cmd->iov_size > iov_size) {
trace_megasas_iovec_overflow(cmd->index, iov_size, cmd->iov_size);
+ goto unmap;
} else if (cmd->iov_size < iov_size) {
trace_megasas_iovec_underflow(cmd->index, iov_size, cmd->iov_size);
}
--
2.31.1
next prev parent reply other threads:[~2021-11-19 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 20:11 [PATCH-for-6.2 0/2] hw/scsi/megasas: Avoid overflowing the SGL buffer Philippe Mathieu-Daudé
2021-11-19 20:11 ` Philippe Mathieu-Daudé [this message]
2021-11-19 20:11 ` [PATCH-for-6.2 2/2] tests/qtest/fuzz-megasas-test: Add test for GitLab issue #521 Philippe Mathieu-Daudé
2021-11-22 11:17 ` [PATCH-for-6.2 0/2] hw/scsi/megasas: Avoid overflowing the SGL buffer Darren Kenny
2021-12-13 12:32 ` Philippe Mathieu-Daudé
2021-12-15 10:30 ` Philippe Mathieu-Daudé
2021-12-17 9:22 ` Paolo Bonzini
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=20211119201141.532377-2-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=Qiuhao.Li@outlook.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=darren.kenny@oracle.com \
--cc=fam@euphon.net \
--cc=hare@suse.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).