From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, stephen@networkplumber.org,
sfeldma@cumulusnetworks.com, arvid.brodin@alten.se,
sucheta.chakraborty@qlogic.com
Subject: [patch net-next 1/5] bridge: switch order of rx_handler reg and upper dev link
Date: Fri, 5 Sep 2014 15:51:28 +0200 [thread overview]
Message-ID: <1409925092-17808-2-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1409925092-17808-1-git-send-email-jiri@resnulli.us>
The thing is that netdev_master_upper_dev_link calls
call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev). That generates rtnl
link message and during that, rtnl_link_ops->fill_slave_info is called.
But with current ordering, rx_handler and IFF_BRIDGE_PORT are not set
yet so there would have to be check for that in fill_slave_info callback.
Resolve this by reordering to similar what bonding and team does to
avoid the check.
Also add removal of IFF_BRIDGE_PORT flag into error path.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
net/bridge/br_if.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 078d336..a9f54a9 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -252,12 +252,12 @@ static void del_nbp(struct net_bridge_port *p)
br_fdb_delete_by_port(br, p, 1);
nbp_update_port_count(br);
+ netdev_upper_dev_unlink(dev, br->dev);
+
dev->priv_flags &= ~IFF_BRIDGE_PORT;
netdev_rx_handler_unregister(dev);
- netdev_upper_dev_unlink(dev, br->dev);
-
br_multicast_del_port(p);
kobject_uevent(&p->kobj, KOBJ_REMOVE);
@@ -476,16 +476,16 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if (err)
goto err3;
- err = netdev_master_upper_dev_link(dev, br->dev);
+ err = netdev_rx_handler_register(dev, br_handle_frame, p);
if (err)
goto err4;
- err = netdev_rx_handler_register(dev, br_handle_frame, p);
+ dev->priv_flags |= IFF_BRIDGE_PORT;
+
+ err = netdev_master_upper_dev_link(dev, br->dev);
if (err)
goto err5;
- dev->priv_flags |= IFF_BRIDGE_PORT;
-
dev_disable_lro(dev);
list_add_rcu(&p->list, &br->port_list);
@@ -520,7 +520,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
return 0;
err5:
- netdev_upper_dev_unlink(dev, br->dev);
+ dev->priv_flags &= ~IFF_BRIDGE_PORT;
+ netdev_rx_handler_unregister(dev);
err4:
br_netpoll_disable(p);
err3:
--
1.9.3
next prev parent reply other threads:[~2014-09-05 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 13:51 [patch net-next 0/5] bridge: implement rtnl_link options for getting and setting bridge options Jiri Pirko
2014-09-05 13:51 ` Jiri Pirko [this message]
2014-09-05 13:51 ` [patch net-next 2/5] bridge: implement rtnl_link_ops->get_slave_size and rtnl_link_ops->fill_slave_info Jiri Pirko
2014-09-05 13:51 ` [patch net-next 3/5] bridge: implement rtnl_link_ops->slave_changelink Jiri Pirko
2014-09-05 13:51 ` [patch net-next 4/5] bridge: implement rtnl_link_ops->get_size and rtnl_link_ops->fill_info Jiri Pirko
2014-09-05 13:51 ` [patch net-next 5/5] bridge: implement rtnl_link_ops->changelink Jiri Pirko
2014-09-05 13:55 ` [patch iproute2 1/2] add bridge_slave device support Jiri Pirko
2014-09-05 13:55 ` [patch iproute2 2/2] add bridge master " Jiri Pirko
2014-09-28 23:09 ` [patch iproute2 1/2] add bridge_slave " Stephen Hemminger
2014-09-28 23:33 ` Stephen Hemminger
2014-09-29 18:20 ` Or Gerlitz
2014-09-30 8:05 ` Jiri Pirko
2014-09-05 17:06 ` [patch net-next 0/5] bridge: implement rtnl_link options for getting and setting bridge options Stephen Hemminger
2014-09-07 23:06 ` David Miller
2014-09-09 18:30 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409925092-17808-2-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=arvid.brodin@alten.se \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
--cc=sucheta.chakraborty@qlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).