patches for DPDK stable branches
 help / color / mirror / Atom feed
From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <david.marchand@redhat.com>, <jerinj@marvell.com>,
	<hkalra@marvell.com>, <jerry.lilijun@huawei.com>,
	<xudingke@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>,
	<stable@dpdk.org>
Subject: [dpdk-stable] [dpdk-dev] [PATCH] eal: fix dereference before null check
Date: Sat, 19 Sep 2020 18:34:30 +0800	[thread overview]
Message-ID: <1600511670-27576-1-git-send-email-wangyunjian@huawei.com> (raw)

From: Yunjian Wang <wangyunjian@huawei.com>

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 <wangyunjian@huawei.com>
---
 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;
 }
 
@@ -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;
 }
 
-- 
2.23.0


             reply	other threads:[~2020-09-19 10:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-19 10:34 wangyunjian [this message]
2020-10-14 17:02 ` Ferruh Yigit
2020-10-15  2:29   ` wangyunjian
2020-10-15  8:42 ` [dpdk-stable] [dpdk-dev] [PATCH v2] eal: fix dereference after " wangyunjian
2020-10-22 20:01   ` David Marchand
2020-10-28 21:18   ` [dpdk-stable] [EXT] " Harman Kalra
2020-10-29 16:09     ` David Marchand

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=1600511670-27576-1-git-send-email-wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=stable@dpdk.org \
    --cc=xudingke@huawei.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).