Skip to content

Commit af5eba2

Browse files
Fix virtio-sock pci_vtsock_proc_tx uninitialized memory use (GHSL-2021-057)
Signed-off-by: Frederic Dalleau <frederic.dalleau@docker.com>
1 parent 41272a9 commit af5eba2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/pci_virtio_sock.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,11 @@ static void pci_vtsock_proc_tx(struct pci_vtsock_softc *sc,
11211121
size_t pulled;
11221122

11231123
iovec_len = vq_getchain(vq, &idx, iov, VTSOCK_MAXSEGS, flags);
1124+
if (iovec_len < 0) {
1125+
fprintf(stderr, "TX: failed to get chain at idx %"PRIx16"\n", idx);
1126+
return;
1127+
}
1128+
11241129
assert(iovec_len <= VTSOCK_MAXSEGS);
11251130

11261131
DPRINTF(("TX: chain with %d buffers at idx %"PRIx16"\n",

0 commit comments

Comments
 (0)