mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-23 14:11:48 +00:00
block: prevent multiwrite_merge from creating too large iovecs
If we go over the maximum number of iovecs support by syscall we get back EINVAL from the kernel which translate to I/O errors for the guest. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
1d44952fc7
commit
0076bc0c1d
4
block.c
4
block.c
@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs,
|
||||
merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]);
|
||||
}
|
||||
|
||||
if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) {
|
||||
merge = 0;
|
||||
}
|
||||
|
||||
if (merge) {
|
||||
size_t size;
|
||||
QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
|
||||
|
Loading…
x
Reference in New Issue
Block a user