From: Jason Wang Date: Thu, 10 Mar 2022 07:52:11 +0000 (+0800) Subject: vhost: allow batching hint without size X-Git-Tag: v6.1-rc5~1854^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=95932ab2ea07b79cdb33121e2f40ccda9e6a73b5;p=platform%2Fkernel%2Flinux-starfive.git vhost: allow batching hint without size Commit e2ae38cf3d91 ("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: e2ae38cf3d91 ("vhost: fix hung thread due to erroneous iotlb entries") Reported-by: Eli Cohen Cc: Anirudh Rayabharam Signed-off-by: Jason Wang Link: https://lore.kernel.org/r/20220310075211.4801-1-jasowang@redhat.com Signed-off-by: Michael S. Tsirkin Tested-by: Eli Cohen --- diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 082380c..1768362 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -1170,7 +1170,9 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev, goto done; } - if (msg.size == 0) { + if ((msg.type == VHOST_IOTLB_UPDATE || + msg.type == VHOST_IOTLB_INVALIDATE) && + msg.size == 0) { ret = -EINVAL; goto done; }