diff options
| author | Linfeng Sun <linfeng.sun.dev@gmail.com> | 2026-10-09 17:09:12 +0800 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-11-03 07:32:07 -0500 |
| commit | 3d8c5b714c186d08c8fe8c8cfd1f9b89525ab067 (patch) | |
| tree | 6a7e948a3ece59eccf634853e56ad2c37b6def4d /scripts/Makefile.thinlto | |
| parent | 1f5bc40e33d8b3e5e3b89047956099b0c19f1d3d (diff) | |
| download | linux-next-3d8c5b714c186d08c8fe8c8cfd1f9b89525ab067.tar.gz linux-next-3d8c5b714c186d08c8fe8c8cfd1f9b89525ab067.zip | |
vhost-scsi: validate event queue descriptor direction
vhost_get_vq_desc() returns the number of device readable (output) and
device writable (input) iovec segments. A guest can submit an eventq
descriptor chain that fills vq->iov with output segments, setting out
to ARRAY_SIZE(vq->iov) and in to zero.
When the host later queues a vhost-scsi event, vhost_scsi_do_evt_work()
uses out as the index of the first input segment. This accesses one element
beyond vq->iov and triggers an array-index-out-of-bounds report. With
panic_on_warn enabled, the report panics the host.
The event queue accepts device writable buffers only. Reject chains that
contain output segments or lack an input segment before using out as an
index. The input check prevents the out-of-bounds access, while the output
check validates the eventq descriptor direction.
I found the descriptor direction issue myself, though the patch was
written with AI assistance. The out-of-bounds read with an
output-only chain was separately reported by Jia Jia.
Fixes: a6c9af87363c ("tcm_vhost: Add hotplug/hotunplug support")
Reported-by: Jia Jia <physicalmtea@gmail.com>
Assisted-by: OpenAI-Codex:GPT-5
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20261009-fix-arrary-index-out-of-bounds-in-vhost_scsi_complete_events-v2-1-1f7689a54735@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
