]> git.baikalelectronics.ru Git - kernel.git/commit
rocker: do not make neighbour entry changes when preparing transactions
authorSimon Horman <simon.horman@netronome.com>
Thu, 21 May 2015 03:40:16 +0000 (12:40 +0900)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 May 2015 21:20:55 +0000 (17:20 -0400)
commit15b6326bfa68c9abb66808a5d49094fbbcc3af79
tree241874120ae916ad13b5e94286dece582bdd4d97
parent4db0201ba8da9e4a1e3a528130b166a3ad83b718
rocker: do not make neighbour entry changes when preparing transactions

rocker_port_ipv4_nh() and in turn rocker_port_ipv4_neigh() may be
be called with trans == SWITCHDEV_TRANS_PREPARE and then
trans == SWITCHDEV_TRANS_COMMIT from switchdev_port_obj_set() via
fib_table_insert().

The first time that rocker_port_ipv4_nh() is called, with
trans == SWITCHDEV_TRANS_PREPARE, _rocker_neigh_add() adds a new entry to
the neigh table.

And the second time  rocker_port_ipv4_nh() is called, with
trans == SWITCHDEV_TRANS_COMMIT, that entry is found. This causes
rocker_port_ipv4_nh() to believe it is not adding an entry and thus it
frees "entry", which is still present in rocker driver's neigh table.

This problem does not appear to affect deletion as my analysis is that
deletion is always performed with trans == SWITCHDEV_TRANS_NONE.

For completeness _rocker_neigh_{add,del,prepare} are updated not to
manipulate fib table entries if trans == SWITCHDEV_TRANS_PREPARE.

Fixes: c932bd4ff32b ("rocker: support prepare-commit transaction model")
Reported-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Acked-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.c