[ovs-dev] [PATCH] netdev-dpdk: vhost: Fix double free and use after free with QoS.

Maxime Coquelin maxime.coquelin at redhat.com
Wed Aug 10 13:41:58 UTC 2016



On 08/10/2016 11:43 AM, Ilya Maximets wrote:
> While using QoS with vHost interfaces 'netdev_dpdk_qos_run__()' will
> free mbufs while executing 'netdev_dpdk_policer_run()'. After
> that same mbufs will be freed at the end of '__netdev_dpdk_vhost_send()'
> if 'may_steal == true'. This behaviour will break mempool.
>
> Also 'netdev_dpdk_qos_run__()' will free packets even if we shouldn't
> do this ('may_steal == false'). This will lead to using of already freed
> packets by the upper layers.
>
> Fix that by copying all packets that we can't steal like it done
> for DPDK_DEV_ETH devices and freeing only packets not freed by QoS.
>
> Fixes: 0bf765f753fd ("netdev_dpdk.c: Add QoS functionality.")
> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
> ---
>  lib/netdev-dpdk.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)

It looks good to me.
Also, it would simplify my RFC patch:
netdev-dpdk: Add SW queue before Vhost-user Rx virtqueue
I will rework it as soon as your patch is accepted.

FWIW,
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks!
Maxime



More information about the dev mailing list