]> git.baikalelectronics.ru Git - kernel.git/commit
team: move add to port list before port enablement
authorJiri Pirko <jiri@resnulli.us>
Sat, 8 Jun 2013 13:00:54 +0000 (15:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 Jun 2013 07:56:27 +0000 (00:56 -0700)
commit7f6660d819fdd2b47f59af26ac19d3ebcb0cdb76
treef542a207e79b8d9fda9edf98f384d49ca87db126
parent9646522bd733565d6e9f18981395a5de06dd1cf5
team: move add to port list before port enablement

team_port_enable() adds port to port_hashlist. Reader sees port
in team_get_port_by_index_rcu() and returns it, but
team_get_first_port_txable_rcu() tries to go through port_list, where the
port is not inserted yet -> NULL pointer dereference.
Fix this by reordering port_list and port_hashlist insertion.
Panic is easily triggeable when txing packets and adding/removing port
in a loop.

Introduced by commit c4c5d58b "net: introduce ethernet teaming device"

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/team/team.c