提交 0076bc0c 编写于 作者: C Christoph Hellwig 提交者: Anthony Liguori

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: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 1d44952f
...@@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, ...@@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs,
merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]); 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) { if (merge) {
size_t size; size_t size;
QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov)); QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册