Commit e8b4fc13 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

net: mvneta: Prevent out of bounds read in mvneta_config_rss()

The pp->indir[0] value comes from the user.  It is passed to:

	if (cpu_online(pp->rxq_def))

inside the mvneta_percpu_elect() function.  It needs bounds checkeding
to ensure that it is not beyond the end of the cpu bitmap.

Fixes: cad5d847 ("net: mvneta: Fix the CPU choice in mvneta_percpu_elect")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d50b7914
...@@ -4927,6 +4927,9 @@ static int mvneta_config_rss(struct mvneta_port *pp) ...@@ -4927,6 +4927,9 @@ static int mvneta_config_rss(struct mvneta_port *pp)
napi_disable(&pp->napi); napi_disable(&pp->napi);
} }
if (pp->indir[0] >= nr_cpu_ids)
return -EINVAL;
pp->rxq_def = pp->indir[0]; pp->rxq_def = pp->indir[0];
/* Update unicast mapping */ /* Update unicast mapping */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment