From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/4] scsi-generic: avoid out-of-bounds access to VPD page list
Date: Tue, 6 Nov 2018 13:40:30 -0200 [thread overview]
Message-ID: <c2aeac3a-07c9-f5ef-16e5-48e384f50a72@gmail.com> (raw)
In-Reply-To: <20181029173437.32559-3-pbonzini@redhat.com>
On 10/29/18 2:34 PM, Paolo Bonzini wrote:
> A device can report an excessive number of VPD pages when asked for a
> list; this can cause an out-of-bounds access to buf in
> scsi_generic_set_vpd_bl_emulation. It should not happen, but
> it is technically not incorrect so handle it: do not check any byte
> past the allocation length that was sent to the INQUIRY command.
>
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> hw/scsi/scsi-generic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
> index aebb7cdd82..c5497bbea8 100644
> --- a/hw/scsi/scsi-generic.c
> +++ b/hw/scsi/scsi-generic.c
> @@ -538,7 +538,7 @@ static void scsi_generic_set_vpd_bl_emulation(SCSIDevice *s)
> }
>
> page_len = buf[3];
> - for (i = 4; i < page_len + 4; i++) {
> + for (i = 4; i < MIN(sizeof(buf), page_len + 4); i++) {
> if (buf[i] == 0xb0) {
> s->needs_vpd_bl_emulation = false;
> return;
next prev parent reply other threads:[~2018-11-06 15:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-29 17:34 [Qemu-devel] [PATCH 0/4] scsi-generic: fixes for Block Limits emulation Paolo Bonzini
2018-10-29 17:34 ` [Qemu-devel] [PATCH 1/4] scsi-generic: keep VPD page list sorted Paolo Bonzini
2018-11-06 1:45 ` Max Reitz
2018-11-06 15:39 ` Daniel Henrique Barboza
2018-10-29 17:34 ` [Qemu-devel] [PATCH 2/4] scsi-generic: avoid out-of-bounds access to VPD page list Paolo Bonzini
2018-10-30 21:26 ` Philippe Mathieu-Daudé
2018-11-06 1:52 ` Max Reitz
2018-11-06 15:40 ` Daniel Henrique Barboza [this message]
2018-10-29 17:34 ` [Qemu-devel] [PATCH 3/4] scsi-generic: avoid invalid access to struct when emulating block limits Paolo Bonzini
2018-11-06 2:16 ` Max Reitz
2018-11-06 9:44 ` Paolo Bonzini
2018-10-29 17:34 ` [Qemu-devel] [PATCH 4/4] scsi-generic: do not do VPD emulation for sense other than ILLEGAL_REQUEST Paolo Bonzini
2018-11-06 2:22 ` Max Reitz
2018-10-31 23:17 ` [Qemu-devel] [PATCH 0/4] scsi-generic: fixes for Block Limits emulation no-reply
2018-10-31 23:27 ` no-reply
2018-11-06 15:31 ` no-reply
2018-11-06 15:42 ` no-reply
2018-11-06 15:54 ` Daniel Henrique Barboza
2018-11-06 18:54 ` Paolo Bonzini
2018-11-07 11:36 ` no-reply
2018-11-07 11:46 ` no-reply
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=c2aeac3a-07c9-f5ef-16e5-48e384f50a72@gmail.com \
--to=danielhb413@gmail.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--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).