[dpdk-dev] [PATCH v5] vhost: check header for legacy dequeue offload

Maxime Coquelin maxime.coquelin at redhat.com
Tue Jul 13 11:34:18 CEST 2021


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: stable at dpdk.org
> 
> Signed-off-by: Xiao Wang <xiao.w.wang at intel.com>
> ---
> 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 <maxime.coquelin at redhat.com>

Thanks,
Maxime



More information about the dev mailing list