Fix possible crash on error path in
qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in
88ddffae8fc the bug was introduced later in commit 469c71edc72 (when
qcow2_remove_persistent_dirty_bitmap was added).
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
block/qcow2-bitmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c
index 3e8735a20d..e8d3bdbd6e 100644
--- a/block/qcow2-bitmap.c
+++ b/block/qcow2-bitmap.c
@@ -487,6 +487,10 @@ static inline void bitmap_directory_to_be(uint8_t *dir, size_t size)
static void bitmap_free(Qcow2Bitmap *bm)
{
+ if (bm == NULL) {
+ return;
+ }
+
g_free(bm->name);
g_free(bm);
}
--
2.11.1
On 2017-07-14 14:33, Vladimir Sementsov-Ogievskiy wrote: > Fix possible crash on error path in > qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in > 88ddffae8fc the bug was introduced later in commit 469c71edc72 (when > qcow2_remove_persistent_dirty_bitmap was added). > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > Reviewed-by: Eric Blake <eblake@redhat.com> > --- > block/qcow2-bitmap.c | 4 ++++ > 1 file changed, 4 insertions(+) Thanks, applied to my block branch: https://github.com/XanClic/qemu/commits/block Max
Maybe worth adding "Coverity: CID 1377700" On 07/14/2017 01:00 PM, Max Reitz wrote: > On 2017-07-14 14:33, Vladimir Sementsov-Ogievskiy wrote: >> Fix possible crash on error path in >> qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in >> 88ddffae8fc the bug was introduced later in commit 469c71edc72 (when >> qcow2_remove_persistent_dirty_bitmap was added). >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >> Reviewed-by: Eric Blake <eblake@redhat.com> >> --- >> block/qcow2-bitmap.c | 4 ++++ >> 1 file changed, 4 insertions(+) > > Thanks, applied to my block branch: > > https://github.com/XanClic/qemu/commits/block > > Max >
On 07/25/2017 10:02 AM, Philippe Mathieu-Daudé wrote: > Maybe worth adding "Coverity: CID 1377700" At this point, the PULL request is already posted, so it may be too late. But it's not the end of the world if we miss the extra comment. > > On 07/14/2017 01:00 PM, Max Reitz wrote: >> On 2017-07-14 14:33, Vladimir Sementsov-Ogievskiy wrote: >>> Fix possible crash on error path in >>> qcow2_remove_persistent_dirty_bitmap. Although bitmap_free was added in >>> 88ddffae8fc the bug was introduced later in commit 469c71edc72 (when >>> qcow2_remove_persistent_dirty_bitmap was added). >>> >>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >>> Reviewed-by: Eric Blake <eblake@redhat.com> >>> --- >>> block/qcow2-bitmap.c | 4 ++++ >>> 1 file changed, 4 insertions(+) >> >> Thanks, applied to my block branch: >> >> https://github.com/XanClic/qemu/commits/block >> >> Max >> > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
© 2016 - 2024 Red Hat, Inc.