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 A7D97A04C7 for ; Mon, 14 Sep 2020 19:24:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E6EB1BFC4; Mon, 14 Sep 2020 19:24:10 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2DB8F160; Mon, 14 Sep 2020 19:24:07 +0200 (CEST) IronPort-SDR: G3tQXXiBWxunhpAEaJLCD7LPbggGWvMd3bXSVsRRia7/ApLbl2Civr5BWXddL+IVxePVQsP5cN to/hHE/3j3zw== X-IronPort-AV: E=McAfee;i="6000,8403,9744"; a="160054923" X-IronPort-AV: E=Sophos;i="5.76,426,1592895600"; d="scan'208";a="160054923" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2020 10:24:06 -0700 IronPort-SDR: Y8JA+m1aMNSaKYpfjnL+gVnjDTAbZMapOQhacimHdchGxmGuqQgyqbtgfEdVV4Lg1S7mrAkQBW t+WLPH7Xpr0g== X-IronPort-AV: E=Sophos;i="5.76,426,1592895600"; d="scan'208";a="507219557" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.247.225]) ([10.213.247.225]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2020 10:24:04 -0700 To: wangyunjian , dev@dpdk.org, hemant.agrawal@nxp.com, sachin.saxena@nxp.com Cc: jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org References: From: Ferruh Yigit Message-ID: <9b739041-3cf7-9e5c-5d71-0f09f0e2ff77@intel.com> Date: Mon, 14 Sep 2020 18:24:03 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/dpaa: fix fd check before close 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 8/26/2020 12:54 PM, wangyunjian wrote: > From: Yunjian Wang > > The fd is possibly a negative value while it is passed as an > argument to function "close". Fix the check to the fd. > > Fixes: b9c94167904f ("bus/dpaa: decouple FQ portal alloc and init") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > drivers/bus/dpaa/base/qbman/qman_driver.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c > index 1166d68e2..1bff0bc2f 100644 > --- a/drivers/bus/dpaa/base/qbman/qman_driver.c > +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c > @@ -142,7 +142,7 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) > struct qm_portal_config *q_pcfg; > struct dpaa_ioctl_irq_map irq_map; > struct dpaa_ioctl_portal_map q_map = {0}; > - int q_fd = 0, ret; > + int q_fd = -1, ret; > > q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0); > if (!q_pcfg) { > @@ -191,7 +191,7 @@ struct qman_portal *fsl_qman_fq_portal_create(int *fd) > err: > if (portal) > qman_free_global_portal(portal); > - if (q_fd) > + if (q_fd != -1) > close(q_fd); There is already a 'if (q_fd == -1)' check above to goto this label, what do you think adding a second label to remove duplicated check?