From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: shaguna@chelsio.com, nirranjan@chelsio.com, indranil@chelsio.com
Subject: [dpdk-dev] [PATCH] net/cxgbe: fix NULL deref in CLIP failure path
Date: Thu, 26 Jul 2018 13:49:32 +0530 [thread overview]
Message-ID: <1532593172-10363-1-git-send-email-rahul.lakkireddy@chelsio.com> (raw)
From: Shagun Agrawal <shaguna@chelsio.com>
Fixes: 3f2c1e20 ("net/cxgbe: add Compressed Local IP region")
Coverity issue: 302872
Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
drivers/net/cxgbe/clip_tbl.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c
index fa5281cd4..5e4dc5270 100644
--- a/drivers/net/cxgbe/clip_tbl.c
+++ b/drivers/net/cxgbe/clip_tbl.c
@@ -105,7 +105,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
struct adapter *adap = ethdev2adap(dev);
struct clip_tbl *ctbl = adap->clipt;
struct clip_entry *ce;
- int ret;
+ int ret = 0;
if (!ctbl)
return NULL;
@@ -120,12 +120,10 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
ce->type = FILTER_TYPE_IPV6;
rte_atomic32_set(&ce->refcnt, 1);
ret = clip6_get_mbox(dev, lip);
- if (ret) {
+ if (ret)
dev_debug(adap,
"CLIP FW ADD CMD failed: %d",
ret);
- ce = NULL;
- }
} else {
ce->type = FILTER_TYPE_IPV4;
}
@@ -136,7 +134,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,
}
t4_os_write_unlock(&ctbl->lock);
- return ce;
+ return ret ? NULL : ce;
}
/**
--
2.14.1
next reply other threads:[~2018-07-26 8:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 8:19 Rahul Lakkireddy [this message]
2018-08-02 9:03 ` Thomas Monjalon
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=1532593172-10363-1-git-send-email-rahul.lakkireddy@chelsio.com \
--to=rahul.lakkireddy@chelsio.com \
--cc=dev@dpdk.org \
--cc=indranil@chelsio.com \
--cc=nirranjan@chelsio.com \
--cc=shaguna@chelsio.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).