summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/marvell
diff options
context:
space:
mode:
authorMaxime Chevallier <maxime.chevallier@bootlin.com>2019-05-27 14:52:01 +0300
committerDavid S. Miller <davem@davemloft.net>2019-05-28 21:18:44 +0300
commit7af5b077514269268bc76d3c3384c9ead679eaca (patch)
tree7742e5c597a968577cf8a54793402650c2995ffe /drivers/net/ethernet/marvell
parentcec4f328c929f72ad634e8f385b589bd6eac80e5 (diff)
downloadlinux-7af5b077514269268bc76d3c3384c9ead679eaca.tar.xz
net: mvpp2: cls: Check RSS table index validity when creating a context
Make sure we don't use an out-of-bound index for the per-port RSS context array. As of today, the global context creation in mvpp22_rss_context_create will prevent us from reaching this case, but we should still make sure we are using a sane value anyway. Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index cd0daad011ce..bd19a910dc90 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -1466,6 +1466,9 @@ int mvpp22_port_rss_ctx_create(struct mvpp2_port *port, u32 *port_ctx)
break;
}
+ if (i == MVPP22_N_RSS_TABLES)
+ return -EINVAL;
+
port->rss_ctx[i] = rss_ctx;
*port_ctx = i;