DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Jerome Jutteau <jerome.jutteau@outscale.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/3] vhost: check that a device exists during reset_owner
Date: Mon, 19 Oct 2015 12:35:48 +0800	[thread overview]
Message-ID: <20151019043548.GO3115@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1444986530-20893-3-git-send-email-jerome.jutteau@outscale.com>

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@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@linux.intel.com>

	--yliu

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

  reply	other threads:[~2015-10-19  4:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16  9:08 [dpdk-dev] [PATCH 0/3] vhost: Fix virtio-net on VHOST_USER_RESET_OWNER Jerome Jutteau
2015-10-16  9:08 ` [dpdk-dev] [PATCH 1/3] vhost: avoid device identifier to be reset to 0 in reset_owner Jerome Jutteau
2015-10-16  9:08 ` [dpdk-dev] [PATCH 2/3] vhost: check that a device exists during reset_owner Jerome Jutteau
2015-10-19  4:35   ` Yuanhan Liu [this message]
2015-10-19  9:42     ` Jérôme Jutteau
2015-10-16  9:08 ` [dpdk-dev] [PATCH 3/3] vhost: protect user_get_vring_base from unknown devices Jerome Jutteau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151019043548.GO3115@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=dev@dpdk.org \
    --cc=jerome.jutteau@outscale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).