]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
vxlan: Fix error path in __vxlan_dev_create()
authorPetr Machata <petrm@mellanox.com>
Tue, 18 Dec 2018 13:16:00 +0000 (13:16 +0000)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:32 +0000 (14:21 -0300)
commit775d142f112585304ee3011c9b63a7ab5180a893
tree3c7096edaa619fc4c41d00173b1b8e51287a106d
parent1c1f94eb01eede0ae97f964af0ec97beedd6614e
vxlan: Fix error path in __vxlan_dev_create()

BugLink: https://bugs.launchpad.net/bugs/1855787
[ Upstream commit 6db9246871394b3a136cd52001a0763676563840 ]

When a failure occurs in rtnl_configure_link(), the current code
calls unregister_netdevice() to roll back the earlier call to
register_netdevice(), and jumps to errout, which calls
vxlan_fdb_destroy().

However unregister_netdevice() calls transitively ndo_uninit, which is
vxlan_uninit(), and that already takes care of deleting the default FDB
entry by calling vxlan_fdb_delete_default(). Since the entry added
earlier in __vxlan_dev_create() is exactly the default entry, the
cleanup code in the errout block always leads to double free and thus a
panic.

Besides, since vxlan_fdb_delete_default() always destroys the FDB entry
with notification enabled, the deletion of the default entry is notified
even before the addition was notified.

Instead, move the unregister_netdevice() call after the manual destroy,
which solves both problems.

Fixes: 0241b836732f ("vxlan: fix default fdb entry netlink notify ordering during netdev create")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/vxlan.c