From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E29172C24; Mon, 8 Apr 2019 05:39:14 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Apr 2019 20:39:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,323,1549958400"; d="scan'208";a="140813830" Received: from dpdk-tbie.sh.intel.com ([10.67.104.173]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2019 20:39:12 -0700 Date: Mon, 8 Apr 2019 11:38:45 +0800 From: Tiwei Bie To: Mohammad Abdul Awal Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org Message-ID: <20190408033845.GC20719@dpdk-tbie.sh.intel.com> References: <20190404085317.32337-1-mohammad.abdul.awal@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190404085317.32337-1-mohammad.abdul.awal@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix null pointer checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Apr 2019 03:39:15 -0000 On Thu, Apr 04, 2019 at 09:53:17AM +0100, Mohammad Abdul Awal wrote: > Null value for parameters will cause segfault. > > Fixes: d7280c9fff ("vhost: support selective datapath") > Fixes: 72e8543093df ("vhost: add API to get MTU value") > Fixes: a277c71598 ("vhost: refactor code structure") > Fixes: ca33faf9ef ("vhost: introduce API to fetch negotiated features") > Fixes: eb32247457 ("vhost: export guest memory regions") > Fixes: 40ef286f23 ("vhost: export vhost vring info") > Fixes: bd2e0c3fe5 ("vhost: add APIs for live migration") > Fixes: 0b8572a0c1 ("vhost: add external message handling to the API") > Fixes: b4953225ce ("vhost: add APIs for datapath configuration") Would be better to use the same length (12) for hashes. > Cc: stable@dpdk.org > > Signed-off-by: Mohammad Abdul Awal > --- > lib/librte_vhost/socket.c | 2 +- > lib/librte_vhost/vdpa.c | 5 ++++- > lib/librte_vhost/vhost.c | 16 ++++++++-------- > 3 files changed, 13 insertions(+), 10 deletions(-) > > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index 3da9de62c..a89665946 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -562,7 +562,7 @@ rte_vhost_driver_attach_vdpa_device(const char *path, int did) > { > struct vhost_user_socket *vsocket; > > - if (rte_vdpa_get_device(did) == NULL) > + if (rte_vdpa_get_device(did) == NULL || path == NULL) There are multiple APIs accepting `path` parameter without validating it in socket.c. I meant we can do the check for most of them in find_vhost_user_socket(): https://github.com/DPDK/dpdk/blob/bdcfcceb7a0b7534a0dba669279d18bd0f98d5e5/lib/librte_vhost/socket.c#L546 For the cases which can't be covered by the check in find_vhost_user_socket(), we need to do the check separately, e.g.: https://github.com/DPDK/dpdk/blob/bdcfcceb7a0b7534a0dba669279d18bd0f98d5e5/lib/librte_vhost/socket.c#L972 For the rest, Reviewed-by: Tiwei Bie Thanks! Tiwei From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 0C6C5A0096 for ; Mon, 8 Apr 2019 05:39:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6DAB54C8F; Mon, 8 Apr 2019 05:39:16 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E29172C24; Mon, 8 Apr 2019 05:39:14 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Apr 2019 20:39:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,323,1549958400"; d="scan'208";a="140813830" Received: from dpdk-tbie.sh.intel.com ([10.67.104.173]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2019 20:39:12 -0700 Date: Mon, 8 Apr 2019 11:38:45 +0800 From: Tiwei Bie To: Mohammad Abdul Awal Cc: dev@dpdk.org, maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org Message-ID: <20190408033845.GC20719@dpdk-tbie.sh.intel.com> References: <20190404085317.32337-1-mohammad.abdul.awal@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <20190404085317.32337-1-mohammad.abdul.awal@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix null pointer checking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190408033845._uo9Jsalbtq7gg1etDjeVbxsmaDijfbGXI8rbOAv-y0@z> On Thu, Apr 04, 2019 at 09:53:17AM +0100, Mohammad Abdul Awal wrote: > Null value for parameters will cause segfault. > > Fixes: d7280c9fff ("vhost: support selective datapath") > Fixes: 72e8543093df ("vhost: add API to get MTU value") > Fixes: a277c71598 ("vhost: refactor code structure") > Fixes: ca33faf9ef ("vhost: introduce API to fetch negotiated features") > Fixes: eb32247457 ("vhost: export guest memory regions") > Fixes: 40ef286f23 ("vhost: export vhost vring info") > Fixes: bd2e0c3fe5 ("vhost: add APIs for live migration") > Fixes: 0b8572a0c1 ("vhost: add external message handling to the API") > Fixes: b4953225ce ("vhost: add APIs for datapath configuration") Would be better to use the same length (12) for hashes. > Cc: stable@dpdk.org > > Signed-off-by: Mohammad Abdul Awal > --- > lib/librte_vhost/socket.c | 2 +- > lib/librte_vhost/vdpa.c | 5 ++++- > lib/librte_vhost/vhost.c | 16 ++++++++-------- > 3 files changed, 13 insertions(+), 10 deletions(-) > > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c > index 3da9de62c..a89665946 100644 > --- a/lib/librte_vhost/socket.c > +++ b/lib/librte_vhost/socket.c > @@ -562,7 +562,7 @@ rte_vhost_driver_attach_vdpa_device(const char *path, int did) > { > struct vhost_user_socket *vsocket; > > - if (rte_vdpa_get_device(did) == NULL) > + if (rte_vdpa_get_device(did) == NULL || path == NULL) There are multiple APIs accepting `path` parameter without validating it in socket.c. I meant we can do the check for most of them in find_vhost_user_socket(): https://github.com/DPDK/dpdk/blob/bdcfcceb7a0b7534a0dba669279d18bd0f98d5e5/lib/librte_vhost/socket.c#L546 For the cases which can't be covered by the check in find_vhost_user_socket(), we need to do the check separately, e.g.: https://github.com/DPDK/dpdk/blob/bdcfcceb7a0b7534a0dba669279d18bd0f98d5e5/lib/librte_vhost/socket.c#L972 For the rest, Reviewed-by: Tiwei Bie Thanks! Tiwei