diff options
author | Christoph Hellwig <hch@lst.de> | 2010-01-19 22:15:39 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-20 08:51:40 -0600 |
commit | 0076bc0c1d93adcbc7f1af184e04902cf37e9ab8 (patch) | |
tree | 7c0bc0f4f0ab2d7424d3d162e56f394ef11c5584 /block.c | |
parent | 1d44952fc7f4de113eae892401e4d50ee476e82e (diff) |
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>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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)); |