From 8dca8cc5c6be70ef5b3826ffdcfdc5b2cf4fc82c Mon Sep 17 00:00:00 2001 From: Rahul Lakkireddy Date: Tue, 19 Jan 2016 15:47:07 +0530 Subject: [PATCH] cxgbe: fix allocated size for RSS table 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_16_04.rst | 6 ++++++ drivers/net/cxgbe/cxgbe_main.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 6ecfd3f4e3..4abe246d80 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -156,6 +156,12 @@ Drivers Fixed issue in ethdev library that the structure for setting fdir's mask and flow entry was not consistent in byte ordering. +* **cxgbe: Fixed crash 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. + * **aesni_mb: Fixed wrong return value when creating a device.** cryptodev_aesni_mb_init() was returning the device id of the device created, diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c index 649b941cbf..552b11f229 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.20.1