net: systemport: fix index check to avoid an array out of bounds access
PATCH 1/1 net: systemport: fix index check to avoid an array out of bounds access
From: Colin Ian King <[email protected]>
Currently the bounds check on index is off by one and can lead to an out of bounds access on array priv->filters_loc when index is RXCHK_BRCM_TAG_MAX.
Fixes bb9051a2b230 ("net: systemport: Add support for WAKE_FILTER")
Signed-off-by Colin Ian King <[email protected]>
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
@@ -2133,7 +2133,7 @@ static int bcm_sysport_rule_set(struct bcm_sysport_priv *priv,return -ENOSPC ; index =find_first_zero_bit (priv->filters,RXCHK_BRCM_TAG_MAX ); -if (index >RXCHK_BRCM_TAG_MAX ) +if (index >=RXCHK_BRCM_TAG_MAX )return -ENOSPC ;/* Location is the classification ID, and index is the position
Signature · 1 line
2.25.1
David Miller
maintainerFrom: Colin King <[email protected]>
Date: Thu, 12 Mar 2020 15:04:30 +0000
Quoted 8 lines
From: Colin Ian King <[email protected]>
Currently the bounds check on index is off by one and can lead to an out of bounds access on array
priv->filters_locwhen index isRXCHK_BRCM_TAG_MAX.Fixes bb9051a2b230 ("net: systemport: Add support for WAKE_FILTER")Signed-off-by Colin Ian King <[email protected]>
Applied and queued up for -stable, thanks.