[PATCH 4.4 253/312] ovs/gre: fix rtnl notifications on iface deletion

From: Greg Kroah-Hartman
Date: Fri May 08 2020 - 09:14:53 EST


From: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>

commit da6f1da819d4b9c081a477dec74dc468a0b44290 upstream.

The function gretap_fb_dev_create() (only used by ovs) never calls
rtnl_configure_link(). The consequence is that dev->rtnl_link_state is
never set to RTNL_LINK_INITIALIZED.
During the deletion phase, the function rollback_registered_many() sends
a RTM_DELLINK only if dev->rtnl_link_state is set to RTNL_LINK_INITIALIZED.

Fixes: b2acd1dc3949 ("openvswitch: Use regular GRE net_device instead of vport")
CC: Thomas Graf <tgraf@xxxxxxx>
CC: Pravin B Shelar <pshelar@xxxxxxxxxx>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@xxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
net/ipv4/ip_gre.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1265,6 +1265,10 @@ struct net_device *gretap_fb_dev_create(
if (err)
goto out;

+ err = rtnl_configure_link(dev, NULL);
+ if (err < 0)
+ goto out;
+
return dev;
out:
ip_tunnel_dellink(dev, &list_kill);