diff options
author | Jiri Benc <jbenc@redhat.com> | 2017-07-02 19:00:57 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-21 07:42:18 +0200 |
commit | beabc6032772d186976742438d6b1f290894ce44 (patch) | |
tree | 59ba0aa8a1aa117e6e84ca60ad64e5daa5cba352 /include/net | |
parent | d2c9512085784a6387d688f57b2671c6c15fc984 (diff) | |
download | linux-stable-beabc6032772d186976742438d6b1f290894ce44.tar.gz linux-stable-beabc6032772d186976742438d6b1f290894ce44.tar.bz2 linux-stable-beabc6032772d186976742438d6b1f290894ce44.zip |
vxlan: fix hlist corruption
[ Upstream commit 69e766612c4bcb79e19cebed9eed61d4222c1d47 ]
It's not a good idea to add the same hlist_node to two different hash lists.
This leads to various hard to debug memory corruptions.
Fixes: b1be00a6c39f ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/vxlan.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index 308adc4154f4..9fce47e3e13e 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h @@ -221,9 +221,17 @@ struct vxlan_config { bool no_share; }; +struct vxlan_dev_node { + struct hlist_node hlist; + struct vxlan_dev *vxlan; +}; + /* Pseudo network device */ struct vxlan_dev { - struct hlist_node hlist; /* vni hash table */ + struct vxlan_dev_node hlist4; /* vni hash table for IPv4 socket */ +#if IS_ENABLED(CONFIG_IPV6) + struct vxlan_dev_node hlist6; /* vni hash table for IPv6 socket */ +#endif struct list_head next; /* vxlan's per namespace list */ struct vxlan_sock __rcu *vn4_sock; /* listening socket for IPv4 */ #if IS_ENABLED(CONFIG_IPV6) |