From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-05 19:08:15
.dellink does not get called after .newlink fails,
bareudp_newlink() must undo what bareudp_configure()
has done if bareudp_link_config() fails.
v2: call bareudp_dellink(), like bareudp_dev_create() does
Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/bareudp.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
From: Cong Wang <hidden> Date: 2021-01-05 20:39:47
On Tue, Jan 5, 2021 at 11:07 AM Jakub Kicinski [off-list ref] wrote:
.dellink does not get called after .newlink fails,
bareudp_newlink() must undo what bareudp_configure()
has done if bareudp_link_config() fails.
v2: call bareudp_dellink(), like bareudp_dev_create() does
Thanks for the update. Just one question below.
quoted hunk
Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/bareudp.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
@@ -645,11 +645,20 @@ static int bareudp_link_config(struct net_device *dev,return0;}+staticvoidbareudp_dellink(structnet_device*dev,structlist_head*head)+{+structbareudp_dev*bareudp=netdev_priv(dev);++list_del(&bareudp->next);+unregister_netdevice_queue(dev,head);+}+staticintbareudp_newlink(structnet*net,structnet_device*dev,structnlattr*tb[],structnlattr*data[],structnetlink_ext_ack*extack){structbareudp_confconf;+LIST_HEAD(list_kill);interr;err=bareudp2info(data,&conf,extack);
@@ -662,17 +671,14 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,err=bareudp_link_config(dev,tb);if(err)-returnerr;+gotoerr_unconfig;return0;-}--staticvoidbareudp_dellink(structnet_device*dev,structlist_head*head)-{-structbareudp_dev*bareudp=netdev_priv(dev);-list_del(&bareudp->next);-unregister_netdevice_queue(dev,head);+err_unconfig:+bareudp_dellink(dev,&list_kill);+unregister_netdevice_many(&list_kill);
Why do we need unregister_netdevice_many() here? I think
bareudp_dellink(dev, NULL) is sufficient as we always have
one instance to unregister?
(For the same reason, bareudp_dev_create() does not need it
either.)
Thanks.
Why do we need unregister_netdevice_many() here? I think
bareudp_dellink(dev, NULL) is sufficient as we always have
one instance to unregister?
(For the same reason, bareudp_dev_create() does not need it
either.)
Ack, I'm following how bareudp_dev_create() is written.
I can follow up in net-next and change both, sounds good?
Why do we need unregister_netdevice_many() here? I think
bareudp_dellink(dev, NULL) is sufficient as we always have
one instance to unregister?
(For the same reason, bareudp_dev_create() does not need it
either.)
Ack, I'm following how bareudp_dev_create() is written.
I can follow up in net-next and change both, sounds good?
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Tue, 5 Jan 2021 11:07:25 -0800 you wrote:
.dellink does not get called after .newlink fails,
bareudp_newlink() must undo what bareudp_configure()
has done if bareudp_link_config() fails.
v2: call bareudp_dellink(), like bareudp_dev_create() does
Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[...]