[source] generic: ar8216: fix invalid bounds check imported from ChromeOS (FS#347)

LEDE Commits lede-commits at lists.infradead.org
Fri Dec 23 10:24:18 PST 2016


jow pushed a commit to source.git, branch master:
https://git.lede-project.org/29cc927ef5a6d2f1e8de0d3d9fc67877aa4b6af7

commit 29cc927ef5a6d2f1e8de0d3d9fc67877aa4b6af7
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Fri Dec 23 19:15:14 2016 +0100

    generic: ar8216: fix invalid bounds check imported from ChromeOS (FS#347)
    
    The priv->vlan_id member is of size AR8X16_MAX_VLANS, not AR8X16_MAX_PORTS,
    so check for the proper maximum value in order to avoid capping valid VLAN IDs
    to 7 (AR8X16_MAX_PORTS - 1).
    
    Signed-off-by: Jo-Philipp Wich <jo at mein.io>
---
 target/linux/generic/files/drivers/net/phy/ar8216.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 746d8e6..27b062b 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -975,7 +975,7 @@ ar8xxx_sw_set_vid(struct switch_dev *dev, const struct switch_attr *attr,
 {
 	struct ar8xxx_priv *priv = swdev_to_ar8xxx(dev);
 
-	if (val->port_vlan >= AR8X16_MAX_PORTS)
+	if (val->port_vlan >= AR8X16_MAX_VLANS)
 		return -EINVAL;
 
 	priv->vlan_id[val->port_vlan] = val->value.i;



More information about the lede-commits mailing list