Skip to content

Commit e8b4fc1

Browse files
error27davem330
authored andcommitted
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: cad5d84 ("net: mvneta: Fix the CPU choice in mvneta_percpu_elect") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d50b791 commit e8b4fc1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4927,6 +4927,9 @@ static int mvneta_config_rss(struct mvneta_port *pp)
49274927
napi_disable(&pp->napi);
49284928
}
49294929

4930+
if (pp->indir[0] >= nr_cpu_ids)
4931+
return -EINVAL;
4932+
49304933
pp->rxq_def = pp->indir[0];
49314934

49324935
/* Update unicast mapping */

0 commit comments

Comments
 (0)