From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 57AC05A6C for ; Mon, 19 Oct 2015 06:34:00 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 18 Oct 2015 21:34:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,700,1437462000"; d="scan'208";a="583504118" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by FMSMGA003.fm.intel.com with ESMTP; 18 Oct 2015 21:33:58 -0700 Date: Mon, 19 Oct 2015 12:35:48 +0800 From: Yuanhan Liu To: Jerome Jutteau Message-ID: <20151019043548.GO3115@yliu-dev.sh.intel.com> References: <1444986530-20893-1-git-send-email-jerome.jutteau@outscale.com> <1444986530-20893-3-git-send-email-jerome.jutteau@outscale.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444986530-20893-3-git-send-email-jerome.jutteau@outscale.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 2/3] vhost: check that a device exists during reset_owner X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 04:34:00 -0000 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 > --- > 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 --yliu > device_fh = ll_dev->dev.device_fh; > > cleanup_device(&ll_dev->dev); > -- > jerome