diff options
author | Laurent Vivier <lvivier@redhat.com> | 2025-01-21 14:16:02 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-01-21 14:30:42 +0100 |
commit | 4f2c8e79130ef3d6132e34c49746e397745f9d73 (patch) | |
tree | b7192ca98ebf746754c77802b4eff1718042bcf9 | |
parent | ec5c4d936dafcbc5e07caeb594dfd771050da221 (diff) | |
download | passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.tar passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.tar.gz passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.tar.bz2 passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.tar.lz passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.tar.xz passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.tar.zst passt-4f2c8e79130ef3d6132e34c49746e397745f9d73.zip |
vhost_user: Drop packet with unsupported iovec array2025_01_21.4f2c8e7
If the iovec array cannot be managed, drop it rather than
passing the second entry to tap_add_packet().
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | vu_common.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vu_common.c b/vu_common.c index aa5ca7b..f43d8ac 100644 --- a/vu_common.c +++ b/vu_common.c @@ -195,15 +195,17 @@ static void vu_handle_tx(struct vu_dev *vdev, int index, hdrlen); } else { /* vnet header can be in a separate iovec */ - if (elem[count].out_num != 2) + if (elem[count].out_num != 2) { debug("virtio-net transmit queue contains more than one buffer ([%d]: %u)", count, elem[count].out_num); - if (elem[count].out_sg[0].iov_len != (size_t)hdrlen) + } else if (elem[count].out_sg[0].iov_len != (size_t)hdrlen) { debug("virtio-net transmit queue entry not aligned on hdrlen ([%d]: %d != %zu)", - count, hdrlen, elem[count].out_sg[0].iov_len); - tap_add_packet(vdev->context, - elem[count].out_sg[1].iov_len, - (char *)elem[count].out_sg[1].iov_base); + count, hdrlen, elem[count].out_sg[0].iov_len); + } else { + tap_add_packet(vdev->context, + elem[count].out_sg[1].iov_len, + (char *)elem[count].out_sg[1].iov_base); + } } count++; |