From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 196CAA04DC for ; Wed, 14 Oct 2020 19:03:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E6E571DACF; Wed, 14 Oct 2020 19:03:02 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 0F52A1BCF5; Wed, 14 Oct 2020 19:02:57 +0200 (CEST) IronPort-SDR: ZRYOpklyKCiVK2tsemieWgg0BEnTVUKjNqfrnhYRVZ+rVoAMrxn39Cr+ttEtakUqLRbnA3/ifD Zs5CcVsWheAg== X-IronPort-AV: E=McAfee;i="6000,8403,9774"; a="162681613" X-IronPort-AV: E=Sophos;i="5.77,375,1596524400"; d="scan'208";a="162681613" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 10:02:55 -0700 IronPort-SDR: xvsXDDZJqTDKGUQf15W+BDeu9u/z7cObasdk2geVzrVB5jVNhsWdVsZeEUyNiWcmWBL8Sxzmvo kCJQAhG/VWYw== X-IronPort-AV: E=Sophos;i="5.77,375,1596524400"; d="scan'208";a="463953427" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.212.224]) ([10.213.212.224]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 10:02:53 -0700 To: wangyunjian , dev@dpdk.org Cc: david.marchand@redhat.com, jerinj@marvell.com, hkalra@marvell.com, jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org References: <1600511670-27576-1-git-send-email-wangyunjian@huawei.com> From: Ferruh Yigit Message-ID: Date: Wed, 14 Oct 2020 18:02:49 +0100 MIME-Version: 1.0 In-Reply-To: <1600511670-27576-1-git-send-email-wangyunjian@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] eal: fix dereference before null check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On 9/19/2020 11:34 AM, wangyunjian wrote: > From: Yunjian Wang > > This patch fixes (dereference after null check) coverity issue. > The intr_handle may be a null pointer which led to this issue. > > Coverity issue: 357695, 357751 > Fixes: 05c4105738d8 ("trace: add interrupt tracepoints") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > lib/librte_eal/freebsd/eal_interrupts.c | 6 ++++-- > lib/librte_eal/linux/eal_interrupts.c | 6 ++++-- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/lib/librte_eal/freebsd/eal_interrupts.c b/lib/librte_eal/freebsd/eal_interrupts.c > index 6d53d33c8..028ab457a 100644 > --- a/lib/librte_eal/freebsd/eal_interrupts.c > +++ b/lib/librte_eal/freebsd/eal_interrupts.c > @@ -380,7 +380,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle) > } > > out: > - rte_eal_trace_intr_enable(intr_handle, rc); > + if (intr_handle) > + rte_eal_trace_intr_enable(intr_handle, rc); > return rc; > } > > @@ -418,7 +419,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle) > break; > } > out: > - rte_eal_trace_intr_disable(intr_handle, rc); > + if (intr_handle) > + rte_eal_trace_intr_disable(intr_handle, rc); > return rc; > } > > diff --git a/lib/librte_eal/linux/eal_interrupts.c b/lib/librte_eal/linux/eal_interrupts.c > index 13db5c4e8..e46443873 100644 > --- a/lib/librte_eal/linux/eal_interrupts.c > +++ b/lib/librte_eal/linux/eal_interrupts.c > @@ -725,7 +725,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle) > break; > } > out: > - rte_eal_trace_intr_enable(intr_handle, rc); > + if (intr_handle) > + rte_eal_trace_intr_enable(intr_handle, rc); > return rc; It looks like whole function requires 'intr_handle' to be not NULL, so what do you think add following at the very beginning of the function and remove other 'intr_handle' NULL checks from function: if (intr_handle == NULL) return -1; > } > > @@ -852,7 +853,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle) > break; > } > out: > - rte_eal_trace_intr_disable(intr_handle, rc); > + if (intr_handle) > + rte_eal_trace_intr_disable(intr_handle, rc); > return rc; > } > >