DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: dev@dpdk.org
Cc: Rasesh Mody <rasesh.mody@cavium.com>,
	ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com
Subject: [dpdk-dev] [PATCH 8/8] net/qede: fix null pointer dereferences
Date: Tue,  7 Nov 2017 00:34:25 -0800	[thread overview]
Message-ID: <1510043665-8160-9-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1510043665-8160-1-git-send-email-rasesh.mody@cavium.com>

Fix null pointer dereferences in qede_vxlan_enable() and
qede_conf_udp_dst_port()

Coverity issue: 195010, 195012, 198439
Fixes: e0947ed912f7 ("net/qede: add support for VXLAN UDP port config over VF")
Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/qede_ethdev.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 7a589a2..8832145 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -631,7 +631,13 @@ static void qede_set_ucast_cmn_params(struct ecore_filter_ucast *ucast)
 
 	for_each_hwfn(edev, i) {
 		p_hwfn = &edev->hwfns[i];
-		p_ptt = IS_PF(edev) ? ecore_ptt_acquire(p_hwfn) : NULL;
+		if (IS_PF(edev)) {
+			p_ptt = ecore_ptt_acquire(p_hwfn);
+			if (!p_ptt)
+				return -EAGAIN;
+		} else {
+			p_ptt = NULL;
+		}
 		rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt,
 				&tunn, ECORE_SPQ_MODE_CB, NULL);
 		if (rc != ECORE_SUCCESS) {
@@ -2258,7 +2264,13 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		tunn.vxlan_port.port = udp_port;
 		for_each_hwfn(edev, i) {
 			p_hwfn = &edev->hwfns[i];
-			p_ptt = IS_PF(edev) ? ecore_ptt_acquire(p_hwfn) : NULL;
+			if (IS_PF(edev)) {
+				p_ptt = ecore_ptt_acquire(p_hwfn);
+				if (!p_ptt)
+					return -EAGAIN;
+			} else {
+				p_ptt = NULL;
+			}
 			rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt, &tunn,
 						ECORE_SPQ_MODE_CB, NULL);
 			if (rc != ECORE_SUCCESS) {
-- 
1.7.10.3

  parent reply	other threads:[~2017-11-07  8:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  8:34 [dpdk-dev] [PATCH 0/8] net/qede: coverity issue fixes and bug fixes Rasesh Mody
2017-11-07  8:34 ` [dpdk-dev] [PATCH 1/8] net/qede: fix to disable per-VF Tx switching feature Rasesh Mody
2017-11-08  0:53   ` Thomas Monjalon
2017-11-08  1:34     ` Patil, Harish
2017-11-08  1:44       ` Thomas Monjalon
2017-11-08  2:34         ` Patil, Harish
2017-11-07  8:34 ` [dpdk-dev] [PATCH 2/8] net/qede: fix vxlan filter deletion Rasesh Mody
2017-11-07  8:34 ` [dpdk-dev] [PATCH 3/8] net/qede: fix to update device link structure Rasesh Mody
2017-11-07  8:34 ` [dpdk-dev] [PATCH 4/8] net/qede: remove duplicate includes Rasesh Mody
2017-11-07  8:34 ` [dpdk-dev] [PATCH 5/8] net/qede: fix to release the acquired ptt Rasesh Mody
2017-11-07  8:34 ` [dpdk-dev] [PATCH 6/8] net/qede/base: fix to initialize filter API return code Rasesh Mody
2017-11-07  8:34 ` [dpdk-dev] [PATCH 7/8] net/qede/base: fix division by zero Rasesh Mody
2017-11-07  8:34 ` Rasesh Mody [this message]
2017-11-07 22:53 ` [dpdk-dev] [PATCH 0/8] net/qede: coverity issue fixes and bug fixes Ferruh Yigit

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=1510043665-8160-9-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).