Skip to content

Commit

Permalink
net: mvpp2: cls: Check RSS table index validity when creating a context
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Maxime Chevallier authored and David S. Miller committed May 28, 2019
1 parent cec4f32 commit 7af5b07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 7af5b07

Please sign in to comment.