]> git.baikalelectronics.ru Git - kernel.git/commit
vxlan: fix use-after-free on deletion
authorMark Bloch <markb@mellanox.com>
Fri, 2 Jun 2017 00:24:08 +0000 (03:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Jun 2017 18:29:16 +0000 (14:29 -0400)
commit6ff9add78b14d284fe38382863c8ab9311b31a6c
treeebd6ee47e68e774a12c024102cc36b3aee5085ee
parent909fe09ffe2c35c1b617a2f0660828a0dbceb6e8
vxlan: fix use-after-free on deletion

Adding a vxlan interface to a socket isn't symmetrical, while adding
is done in vxlan_open() the deletion is done in vxlan_dellink().
This can cause a use-after-free error when we close the vxlan
interface before deleting it.

We add vxlan_vs_del_dev() to match vxlan_vs_add_dev() and call
it from vxlan_stop() to match the call from vxlan_open().

Fixes: b6d34811a41f ("vxlan: Move socket initialization to within rtnl scope")
Acked-by: Jiri Benc <jbenc@redhat.com>
Tested-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Mark Bloch <markb@mellanox.com>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan.c