qcow2: Check snapshot L1 table in qcow2_snapshot_delete()
commitdb5794f1f17d1f8247c0ea8e6f0376a47b112466
authorAlberto Garcia <berto@igalia.com>
Tue, 6 Mar 2018 16:14:11 +0000 (6 18:14 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 9 Mar 2018 14:17:47 +0000 (9 15:17 +0100)
treeffdca4121775ac6d8d36079310908c8b499e13e1
parenta8475d7573c0598ba8f92f84534110218ee11e3d
qcow2: Check snapshot L1 table in qcow2_snapshot_delete()

This function deletes a snapshot from disk, removing its entry from
the snapshot table, freeing its L1 table and decreasing the refcounts
of all clusters.

The L1 table offset and size are however not validated. If we use
invalid values in this function we'll probably corrupt the image even
more, so we should return an error instead.

We now have a function to take care of this, so let's use it.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-snapshot.c
tests/qemu-iotests/080
tests/qemu-iotests/080.out