summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorFang Xieyan <fangxy@xiaopeng.com>2026-10-21 07:29:56 +0800
committerMichael S. Tsirkin <mst@redhat.com>2026-11-03 05:52:09 -0500
commite244725e86be02cd85cb878b3ed8570eba2e4be1 (patch)
tree3f762025f09adac4ce2f8e3c142a9380c02b4d8f /include/linux/timerqueue.h
parent01c3a5fa6d641c93c7cef4fb25c5f12938316e18 (diff)
vhost: fix used ring index wrap in vhost_add_used_n_in_order
vhost_add_used_n_in_order() advances start by nheads[i] but wraps it with a single subtraction. If start + nheads[i] >= 2 * vq->num, start can remain outside the ring. With used-ring logging enabled, start > vq->num makes (vq->num - start) underflow. log_write() then sets bits beyond the dirty-log bitmap, potentially corrupting adjacent userspace memory. This is reachable on the vhost-net TX path with VIRTIO_F_IN_ORDER: done_idx can reach VHOST_NET_BATCH (64), triggering the issue with a 32-entry ring. Wrap start with a mask to keep it within the ring. VHOST_SET_VRING_NUM enforces a nonzero power-of-two ring size, allowing start to be wrapped using & (vq->num - 1). Fixes: 67a873df0c41 ("vhost: basic in order support") Cc: stable@vger.kernel.org Reviewed-by: Weibin Liu <liuwb@xiaopeng.com> Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20261020232956.99970-1-fangxy@xiaopeng.com>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions