DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: Felix Marti <felix@chelsio.com>,
	Kumar Sanghvi <kumaras@chelsio.com>,
	Nirranjan Kirubaharan <nirranjan@chelsio.com>
Subject: [dpdk-dev] [PATCH 1/2] cxgbe: fix segfault due to incorrect size allocated for rss table
Date: Tue, 19 Jan 2016 15:47:07 +0530	[thread overview]
Message-ID: <07bb83b270fea472112a289d828602d8515b1a80.1453193282.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1453193282.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1453193282.git.rahul.lakkireddy@chelsio.com>

The size of each entry in the port's rss table is actually 2 bytes
and not 1 byte. A segfault occurs when accessing part of port 0's rss
table because it gets overwritten by subsequent port 1's part of the
rss table. Fix by setting the size of each entry appropriately.

Fixes: 92c8a63223e5 ("cxgbe: add device configuration and Rx support")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
 doc/guides/rel_notes/release_2_3.rst | 6 ++++++
 drivers/net/cxgbe/cxgbe_main.c       | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst
index 99de186..4c5843d 100644
--- a/doc/guides/rel_notes/release_2_3.rst
+++ b/doc/guides/rel_notes/release_2_3.rst
@@ -15,6 +15,12 @@ EAL
 Drivers
 ~~~~~~~
 
+* **cxgbe: fix segfault due to incorrect size allocated for rss table**
+
+  Fixed a segfault that occurs when accessing part of port 0's rss
+  table that gets overwritten by subsequent port 1's part of the rss
+  table due to incorrect size allocated for each entry in the table.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index aff23d0..632abc2 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -355,7 +355,7 @@ static int init_rss(struct adapter *adap)
 	for_each_port(adap, i) {
 		struct port_info *pi = adap2pinfo(adap, i);
 
-		pi->rss = rte_zmalloc(NULL, pi->rss_size, 0);
+		pi->rss = rte_zmalloc(NULL, pi->rss_size * sizeof(u16), 0);
 		if (!pi->rss)
 			return -ENOMEM;
 	}
-- 
2.5.3

  reply	other threads:[~2016-01-19 10:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 10:17 [dpdk-dev] [PATCH 0/2] cxgbe: Bug fixes for CXGBE PMD Rahul Lakkireddy
2016-01-19 10:17 ` Rahul Lakkireddy [this message]
2016-01-19 10:17 ` [dpdk-dev] [PATCH 2/2] cxgbe: fix setting wrong device mtu Rahul Lakkireddy
2016-02-12 11:55 ` [dpdk-dev] [PATCH 0/2] cxgbe: Bug fixes for CXGBE PMD Bruce Richardson

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=07bb83b270fea472112a289d828602d8515b1a80.1453193282.git.rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=felix@chelsio.com \
    --cc=kumaras@chelsio.com \
    --cc=nirranjan@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).