]> git.hungrycats.org Git - linux/commit
net: dsa: bcm_sf2: Fix RX_CLS_LOC_ANY overwrite for last rule
authorFlorian Fainelli <f.fainelli@gmail.com>
Tue, 15 May 2018 23:01:23 +0000 (16:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:46:02 +0000 (16:46 +0200)
commit1aa396e0f8e92b8d0849781c0f35d4f955a50d3f
treee8398e8fd6b996b9e39aa032965421fde91baa55
parent6cf21876e2d3825989a5ed3ed5f28a40c363499a
net: dsa: bcm_sf2: Fix RX_CLS_LOC_ANY overwrite for last rule

[ Upstream commit 43a5e00f38fe8933a1c716bfe5b30e97f749d94b ]

When we let the kernel pick up a rule location with RX_CLS_LOC_ANY, we
would be able to overwrite the last rules because of a number of issues.

The IPv4 code path would not be checking that rule_index is within
bounds, and it would also only be allowed to pick up rules from range
0..126 instead of the full 0..127 range. This would lead us to allow
overwriting the last rule when we let the kernel pick-up the location.

Fixes: 3306145866b6 ("net: dsa: bcm_sf2: Move IPv4 CFP processing to specific functions")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/dsa/bcm_sf2_cfp.c