qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Peter Lieven <pl@kamp.de>
Cc: qemu-block@nongnu.org, pbonzini@redhat.com,
	qemu-devel@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
Date: Tue, 31 May 2016 14:44:22 +0800	[thread overview]
Message-ID: <20160531064422.GA21877@ad.usersys.redhat.com> (raw)
In-Reply-To: <1464080368-29584-1-git-send-email-pl@kamp.de>

On Tue, 05/24 10:59, Peter Lieven wrote:
> at least in the path via virtio-blk the maximum size is not
> restricted.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/iscsi.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 2ca8e72..e7d5f7b 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -833,6 +833,13 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs,
>          return &acb->common;
>      }
>  
> +    if (acb->ioh->cmd_len > SCSI_CDB_MAX_SIZE) {
> +        error_report("iSCSI: ioctl error CDB exceeds max size (%d > %d)",
> +                     acb->ioh->cmd_len, SCSI_CDB_MAX_SIZE);
> +        qemu_aio_unref(acb);
> +        return NULL;
> +    }
> +
>      acb->task = malloc(sizeof(struct scsi_task));
>      if (acb->task == NULL) {
>          error_report("iSCSI: Failed to allocate task for scsi command. %s",

Is it better to invoke the cb and report -EINVAL to the caller?

Fam

  reply	other threads:[~2016-05-31  6:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24  8:59 [Qemu-devel] [PATCH] block/iscsi: avoid potential overflow of acb->task->cdb Peter Lieven
2016-05-31  6:44 ` Fam Zheng [this message]
2016-05-31  7:35   ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2016-05-31  8:01     ` Fam Zheng
2016-05-31  7:39   ` Kevin Wolf
2016-05-31  8:03     ` Fam Zheng

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=20160531064422.GA21877@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).