From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Jiang Liu <jiang.liu@huawei.com>,
Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>,
kvm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] vfio-pci: integer overflow in vfio_pci_ioctl()
Date: Tue, 26 Mar 2013 16:39:45 +0300 [thread overview]
Message-ID: <20130326133945.GK9138@mwanda> (raw)
In-Reply-To: <20130326131358.GA11516@longonot.mountain>
On Tue, Mar 26, 2013 at 04:13:58PM +0300, Dan Carpenter wrote:
> The worry here is that a large value of hdr.start would cause a
> read before the start of the array and a crash in
> vfio_msi_set_vector_signal().
>
> The check in vfio_msi_set_block() is not enough:
>
> if (start + count > vdev->num_ctx)
> return -EINVAL;
>
> A large value of "start" would lead to an integer overflow.
>
> The check in vfio_msi_set_vector_signal() doesn't work either:
>
> if (vector >= vdev->num_ctx)
> return -EINVAL;
>
> Here "vector" is "count" casted to a signed int so it would be negative
^^^^^
I meant "start" not "count".
> and thus smaller than "vdev->num_ctx" which is also a signed int.
>
Gar... I hate this patch already. I really should make
vdev->num_ctx an unsigned int. I'll send that in a v2 along with
whatever other suggestions people send.
regards,
dan carpenter
next prev parent reply other threads:[~2013-03-26 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-26 13:13 [patch] vfio-pci: integer overflow in vfio_pci_ioctl() Dan Carpenter
2013-03-26 13:39 ` Dan Carpenter [this message]
2013-03-26 15:03 ` Alex Williamson
2013-03-26 15:13 ` Dan Carpenter
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=20130326133945.GK9138@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=jiang.liu@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=vijaymohan.pandarathil@hp.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