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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 May 2018 18:11:22 +0000 (14:11 -0400)
commit43a5e00f38fe8933a1c716bfe5b30e97f749d94b
tree76373179f27fac7fc28f5cadf60546fe9750f9af
parente1b505a60366399d735312ca38b0a6753a684123
net: dsa: bcm_sf2: Fix RX_CLS_LOC_ANY overwrite for last rule

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>
drivers/net/dsa/bcm_sf2_cfp.c