From: Paolo Bonzini <pbonzini@redhat.com>
To: P J P <ppandit@redhat.com>, qemu-devel@nongnu.org
Cc: Qinghao Tang <luodalongde@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] scsi: initialise info object with appropriate size
Date: Mon, 21 Dec 2015 16:29:22 +0100 [thread overview]
Message-ID: <56781AD2.7020402@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.20.1512211501420.22471@wniryva>
On 21/12/2015 10:43, P J P wrote:
> Hello,
>
> A stack overflow issue was reported by Mr Qinghao Tang, CC'd here. It
> occurs while processing the SCSI controller's CTRL_GET_INFO command, as
> the memset(2) call uses driver supplied 'cmd->iov_size' to initialise
> the '&info' object.
>
> Please see below a proposed patch to fix this issue. Does it look okay?
>
> ===
> From 5823b4a214ede884f4ba597fdd629862620e0f92 Mon Sep 17 00:00:00 2001
> From: Prasad J Pandit <pjp@fedoraproject.org>
> Date: Mon, 21 Dec 2015 14:48:18 +0530
> Subject: [PATCH] scsi: initialise info object with appropriate size
>
> While processing controller 'CTRL_GET_INFO' command, the routine
> 'megasas_ctrl_get_info' overflows the '&info' object size. Use its
> appropriate size to null initialise it.
>
> Reported-by: Qinghao Tang <luodalongde@gmail.com>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
> 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 d7dc667..576f56c 100644
> --- a/hw/scsi/megasas.c
> +++ b/hw/scsi/megasas.c
> @@ -718,7 +718,7 @@ static int megasas_ctrl_get_info(MegasasState *s,
> MegasasCmd *cmd)
> BusChild *kid;
> int num_pd_disks = 0;
>
> - memset(&info, 0x0, cmd->iov_size);
> + memset(&info, 0x0, dcmd_size);
> if (cmd->iov_size < dcmd_size) {
> trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size,
> dcmd_size);
Yes, it is. I've queued this patch to my for-2.6 branch.
Paolo
next prev parent reply other threads:[~2015-12-21 15:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 9:43 [Qemu-devel] [PATCH] scsi: initialise info object with appropriate size P J P
2015-12-21 15:29 ` Paolo Bonzini [this message]
2015-12-21 16:33 ` P J P
2015-12-21 16:39 ` Paolo Bonzini
2015-12-21 17:56 ` P J P
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=56781AD2.7020402@redhat.com \
--to=pbonzini@redhat.com \
--cc=luodalongde@gmail.com \
--cc=ppandit@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.