This is a note to let you know that I've just added the patch titled vhost-vdpa: Fix integer overflow in vhost_vdpa_process_iotlb_update() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: vhost-vdpa-fix-integer-overflow-in-vhost_vdpa_proces.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 2b02d1dea8f0f73d4581d48048776bde55e065e2 Author: Xie Yongji <xieyongji@xxxxxxxxxxxxx> Date: Wed Jul 28 21:07:55 2021 +0800 vhost-vdpa: Fix integer overflow in vhost_vdpa_process_iotlb_update() [ Upstream commit 0e398290cff997610b66e73573faaee70c9a700e ] The "msg->iova + msg->size" addition can have an integer overflow if the iotlb message is from a malicious user space application. So let's fix it. Fixes: 1b48dc03e575 ("vhost: vdpa: report iova range") Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Xie Yongji <xieyongji@xxxxxxxxxxxxx> Acked-by: Jason Wang <jasowang@xxxxxxxxxx> Link: https://lore.kernel.org/r/20210728130756.97-1-xieyongji@xxxxxxxxxxxxx Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 80184153ac7d..c4d53ff06bf8 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -623,7 +623,8 @@ static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v, long pinned; int ret = 0; - if (msg->iova < v->range.first || + if (msg->iova < v->range.first || !msg->size || + msg->iova > U64_MAX - msg->size + 1 || msg->iova + msg->size - 1 > v->range.last) return -EINVAL;