From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from stargate3.asicdesigners.com (stargate.chelsio.com [12.32.117.8]) by dpdk.org (Postfix) with ESMTP id 0ACE58E59 for ; Tue, 19 Jan 2016 11:17:55 +0100 (CET) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate3.asicdesigners.com (8.13.8/8.13.8) with ESMTP id u0JAHmNJ027028; Tue, 19 Jan 2016 02:17:49 -0800 From: Rahul Lakkireddy To: dev@dpdk.org Date: Tue, 19 Jan 2016 15:47:07 +0530 Message-Id: <07bb83b270fea472112a289d828602d8515b1a80.1453193282.git.rahul.lakkireddy@chelsio.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: References: In-Reply-To: References: Cc: Felix Marti , Kumar Sanghvi , Nirranjan Kirubaharan Subject: [dpdk-dev] [PATCH 1/2] cxgbe: fix segfault due to incorrect size allocated for rss table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 10:17:56 -0000 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 Signed-off-by: Kumar Sanghvi --- 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