[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow dete
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH] qcow2: Fix alloc_clusters_noref() overflow detection |
Date: |
Mon, 5 May 2014 14:22:00 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, May 04, 2014 at 05:31:40AM +0200, Max Reitz wrote:
> 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 <address@hidden>
> ---
> block/qcow2-refcount.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan