team: set IFF_TEAM_PORT priv_flag after rx_handler is registered
authorJiri Pirko <jiri@resnulli.us>
Mon, 25 Aug 2014 19:38:27 +0000 (21:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Aug 2014 00:35:44 +0000 (17:35 -0700)
commitd7d3c05135f37d8fdf73f9966d27155cada36e56
tree21a7169b43e0687d1b3170d7a2710502df0e4aaa
parent72b603ee8cfc6be587f301568d79ce38e7ed735d
team: set IFF_TEAM_PORT priv_flag after rx_handler is registered

When one tries to add eth as a port into team and that eth is already in
use by other rx_handler device (macvlan, bond, bridge, ...) a bug in
team_port_add() causes that IFF_TEAM_PORT flag is set before rx_handler
is registered. In between, netdev nofifier is called and
team_device_event() sees IFF_TEAM_PORT and thinks that rx_handler_data
pointer is set to team_port. But it isn't.

Fix this by reordering rx_handler register and IFF_TEAM_PORT priv flag
set so it is very similar to how bonding does this.

Reported-by: Erik Hugne <erik.hugne@ericsson.com>
Fixes: 3d249d4ca7 "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