parallels: Out of image offset in BAT leads to image inflation
authorAlexander Ivanov <alexander.ivanov@virtuozzo.com>
Mon, 24 Apr 2023 09:31:36 +0000 (11:31 +0200)
committerHanna Czenczek <hreitz@redhat.com>
Mon, 5 Jun 2023 11:13:47 +0000 (13:13 +0200)
commitf5e715dbbb1ad73ea700b8179a1b8246b71447fc
tree71f11dd4c419592d0531d4a7903efa03766045c7
parentd7e1905e3f54ff9512db4c7a946a8603b62b108d
parallels: Out of image offset in BAT leads to image inflation

data_end field in BDRVParallelsState is set to the biggest offset present
in BAT. If this offset is outside of the image, any further write will
create the cluster at this offset and/or the image will be truncated to
this offset on close. This is definitely not correct.

Raise an error in parallels_open() if data_end points outside the image
and it is not a check (let the check to repaire the image). Set data_end
to the end of the cluster with the last correct offset.

Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Message-Id: <20230424093147.197643-2-alexander.ivanov@virtuozzo.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
block/parallels.c