* [PATCH] net: systemport: fix index check to avoid an array out of bounds access
@ 2020-03-12 15:04 Colin King
2020-03-12 22:51 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-03-12 15:04 UTC (permalink / raw)
To: Florian Fainelli, David S . Miller, bcm-kernel-feedback-list, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index bea2dbc0e469..af7ce5c5488c 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -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
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: systemport: fix index check to avoid an array out of bounds access
2020-03-12 15:04 [PATCH] net: systemport: fix index check to avoid an array out of bounds access Colin King
@ 2020-03-12 22:51 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-03-12 22:51 UTC (permalink / raw)
To: colin.king
Cc: f.fainelli, bcm-kernel-feedback-list, netdev, kernel-janitors,
linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Thu, 12 Mar 2020 15:04:30 +0000
> From: Colin Ian King <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-12 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 15:04 [PATCH] net: systemport: fix index check to avoid an array out of bounds access Colin King
2020-03-12 22:51 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).