Skip to contentSkip to conversation

qcow2-bitmap: fix bitmap_free

PATCH Applied Vladimir Sementsov-Ogievskiy 4 participants 4 messages Jul 14, 2017 – Jul 25, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qcow2-bitmap: fix bitmap_free

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).

---
 block/qcow2-bitmap.c | 4 ++++
 1 file changed, 4 insertions(+)
block/qcow2-bitmap.c +4 -0
index 3e8735a20d..e8d3bdbd6e 100644
@@ -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);
 }
Signature · 1 line
2.11.1
Applied
#1 lore raw
Quoted 10 lines · Vladimir Sementsov-Ogievskiy

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).

---
 block/qcow2-bitmap.c | 4 ++++
 1 file changed, 4 insertions(+)

Thanks, applied to my block branch:

https://github.com/XanClic/qemu/commits/block

Max

#2 lore raw

Maybe worth adding "Coverity: CID 1377700"

Quoted 18 lines · Max Reitz
Quoted 10 lines · Vladimir Sementsov-Ogievskiy

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).

---
  block/qcow2-bitmap.c | 4 ++++
  1 file changed, 4 insertions(+)

Thanks, applied to my block branch:

https://github.com/XanClic/qemu/commits/block

Max

#3 lore raw
Quoted 1 line · Philippe Mathieu-Daudé

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.

Quoted 21 lines · Max Reitz
Quoted 18 lines · Vladimir Sementsov-Ogievskiy
Quoted 10 lines

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).

---
  block/qcow2-bitmap.c | 4 ++++
  1 file changed, 4 insertions(+)

Thanks, applied to my block branch:

https://github.com/XanClic/qemu/commits/block

Max

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org