From: Fam Zheng <famz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Peter Lieven <pl@kamp.de>,
pbonzini@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block/iscsi: avoid potential overflow of acb->task->cdb
Date: Tue, 31 May 2016 16:03:16 +0800 [thread overview]
Message-ID: <20160531080316.GB23193@ad.usersys.redhat.com> (raw)
In-Reply-To: <20160531073954.GB4415@noname.redhat.com>
On Tue, 05/31 09:39, Kevin Wolf wrote:
> Am 31.05.2016 um 08:44 hat Fam Zheng geschrieben:
> > 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?
>
> By the way, when returning NULL, it looks like bdrv_co_do_ioctl()
> leaks its BdrvIoctlCompletionData. This code was introduced by your
> commit 5c5ae76a ("block: Emulate bdrv_ioctl with bdrv_aio_ioctl and
> track both").
I'll send a patch to fix it now.
Fam
prev parent reply other threads:[~2016-05-31 8:03 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
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 [this message]
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=20160531080316.GB23193@ad.usersys.redhat.com \
--to=famz@redhat.com \
--cc=kwolf@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).