On Fri, Oct 16, 2015 at 11:08:49AM +0200, Jerome Jutteau wrote:
> virtio-net search for it's device in reset_owner.
> The function don't check the return result of get_config_ll_entry
> which can be NULL.
> 
> Signed-off-by: Jerome Jutteau <jerome.jutteau at outscale.com>
> ---
>  lib/librte_vhost/virtio-net.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index 955a29d..ec6a575 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -402,6 +402,8 @@ reset_owner(struct vhost_device_ctx ctx)
>       uint64_t device_fh;
>  
>       ll_dev = get_config_ll_entry(ctx);
> +     if (ll_dev == NULL)
> +             return -1;

I would call get_device() here, which dumps an error message when
it's NULL so that user will get noticed.

Besides that, the 3 patches look good to me, and,

Acked-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>

        --yliu

>       device_fh = ll_dev->dev.device_fh;
>  
>       cleanup_device(&ll_dev->dev);
> -- 
> jerome

Reply via email to