Hi Xiao,
On 6/21/21 10:21 AM, Xiao Wang wrote:
> When parsing the virtio net header and packet header for dequeue offload,
> we need to perform sanity check on the packet header to ensure:
> - No out-of-boundary memory access.
> - The packet header and virtio_net header are valid and aligned.
>
> Fixes: d0cf91303d73 ("vhost: add Tx offload capabilities")
> Cc: [email protected]
>
> Signed-off-by: Xiao Wang <[email protected]>
> ---
> v5:
> - Redefine the function parse_ethernet() to parse_headers(). (David)
> - Use mbuf helpers e.g. rte_pktmbuf_data_len() and rte_pktmbuf_mtod_offset().
> (David)
> - Reset mbuf l2_len, l3_len and ol_flags when detecting anything invalid.
> (David)
> - Improve some check conditions. (David)
> - Move the data_len check for L4 header into parse_headers(), in order to
> avoid
> duplicated checks in CSUM and GSO.
> - Use uint8_t instead of uint16_t for l4_proto variable.
> - Detect more invalid corner cases.
>
> v4:
> - Rebase on head of main branch.
> - Allow empty L4 payload in GSO.
>
> v3:
> - Check data_len before calling rte_pktmbuf_mtod. (David)
>
> v2:
> - Allow empty L4 payload for cksum offload. (Konstantin)
> ---
> lib/vhost/virtio_net.c | 117
> +++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 89 insertions(+), 28 deletions(-)
>
Thanks for the fix, it looks good to me:
Reviewed-by: Maxime Coquelin <[email protected]>
Thanks,
Maxime