parallels: avoid fatal abort on large bitmap L1 table
parallels_load_bitmap() allocated the L1 table with g_new(), which aborts the whole process on allocation failure instead of returning an error. Use g_try_new() and fail the open normally. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Thomas Huth <thuth@redhat.com> CC: Stefan Hajnoczi <stefanha@redhat.com>
Denis V. Lunev committed
Jul 22, 2026 at 18:54 UTC
4b620302ea86d71cc454d8b09a4235e46d6473ab
1 file changed
+7
-1
block/parallels-ext.c
+7
-1
@@ -169,7 +169,13 @@ parallels_load_bitmap(BlockDriverState *bs, uint8_t *data, size_t data_size,
169
}
170
171
if (bf.l1_size != 0) {
172
- l1_table = g_new(uint64_t, bf.l1_size);
172
+ l1_table = g_try_new(uint64_t, bf.l1_size);
173
+ if (!l1_table) {
174
+ error_setg(errp, "Failed to allocate the bitmap L1 table "
175
+ "(%" PRIu32 " entries)", bf.l1_size);
176
+ goto fail;
177
+ }
178
+
179
for (i = 0; i < bf.l1_size; i++, data += sizeof(uint64_t)) {
180
l1_table[i] = ldq_le_p(data);
181
}