提交 b43a4dc6 编写于 作者: J Jason Wang 提交者: Pengyuan Zhao

vhost: allow batching hint without size

mainline inclusion
from mainline-v5.17
commit 95932ab2
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5WXCZ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=95932ab2ea07b79cdb33121e2f40ccda9e6a73b5

----------------------------------------------------------------------

Commit e2ae38cf ("vhost: fix hung thread due to erroneous iotlb
entries") tries to reject the IOTLB message whose size is zero. But
the size is not necessarily meaningful, one example is the batching
hint, so the commit breaks that.

Fixing this be reject zero size message only if the message is used to
update/invalidate the IOTLB.

Fixes: e2ae38cf ("vhost: fix hung thread due to erroneous iotlb entries")
Reported-by: NEli Cohen <elic@nvidia.com>
Cc: Anirudh Rayabharam <mail@anirudhrb.com>
Signed-off-by: NJason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20220310075211.4801-1-jasowang@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
Tested-by: NEli Cohen <elic@nvidia.com>
Signed-off-by: NPengyuan Zhao <zhaopengyuan@hisilicon.com>
上级 1072a086
...@@ -1183,7 +1183,9 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev, ...@@ -1183,7 +1183,9 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
goto done; goto done;
} }
if (msg.size == 0) { if ((msg.type == VHOST_IOTLB_UPDATE ||
msg.type == VHOST_IOTLB_INVALIDATE) &&
msg.size == 0) {
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册