[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200312150430.1136618-1-colin.king@canonical.com>
Date: Thu, 12 Mar 2020 15:04:30 +0000
From: Colin King <colin.king@...onical.com>
To: Florian Fainelli <f.fainelli@...il.com>,
"David S . Miller" <davem@...emloft.net>,
bcm-kernel-feedback-list@...adcom.com, netdev@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] net: systemport: fix index check to avoid an array out of bounds access
From: Colin Ian King <colin.king@...onical.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@...onical.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
Powered by blists - more mailing lists