qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection
Date: Mon, 05 May 2014 17:51:32 +0200	[thread overview]
Message-ID: <5367B384.5080407@redhat.com> (raw)
In-Reply-To: <20140505093615.GD3317@noname.str.redhat.com>

On 05.05.2014 11:36, Kevin Wolf wrote:
> Am 04.05.2014 um 05:31 hat Max Reitz geschrieben:
>> If the very first allocation has a length of 0, the free_cluster_index
>> is still 0 after the for loop, which means that subtracting one from it
>> will underflow and signal an invalid range of clusters by returning
>> -EFBIG. However, there is no such range, as its length is 0.
>>
>> Fix this by preventing underflows on free_cluster_index during the
>> check.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Heh, I wondered about this when I reviewed that other patch, and came to
> the conclusion that it probably doesn't happen. Did you find a case
> where it does happen in fact?

Yes, deleting the last internal snapshot results in a 0-byte allocation 
for the new (empty) snapshot table. If this is the first allocation 
after an image has been opened (which is the case for qemu-img snapshot 
-d), you'll receive the “File too big” error message (which confused me 
quite a bit at first, as I wasn't specifically testing this series).

Max

> Anyway, this can't hurt:
>
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>

  reply	other threads:[~2014-05-05 15:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-04  3:31 [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection Max Reitz
2014-05-05  9:36 ` Kevin Wolf
2014-05-05 15:51   ` Max Reitz [this message]
2014-05-05 12:22 ` Stefan Hajnoczi

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=5367B384.5080407@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).