Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
commit 00f215185878bbb102ec527c3bc1bf64c108dd10 Author: Antonio Quartulli antonio@open-mesh.com Date: Thu Aug 15 23:05:55 2013 +0200
batman-adv: check if a softif_vlan already exists
Before creating a new softif_vlan it is better to check if that does already exist. If so batman-adv should refuse to create a new structure otherwise this would lead to an inconsistent state.
Normally this is not a problem because the operating system will prevent from creating the same vlan twice, but some ancient kernels exhibited an improper behaviour that led to a bug.
Introduced by 952cebb57518ec18dfdebfcb2b85539f58f20779 ("batman-adv: add per VLAN interface attribute framework")
Reported-by: Simon Wunderlich simon.wunderlich@s2003.tu-chemnitz.de Signed-off-by: Antonio Quartulli antonio@open-mesh.com Signed-off-by: Marek Lindner lindner_marek@yahoo.de Tested-by: Simon Wunderlich simon.wunderlich@s2003.tu-chemnitz.de
00f215185878bbb102ec527c3bc1bf64c108dd10 soft-interface.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/soft-interface.c b/soft-interface.c index d018c49..bafc811 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -450,6 +450,12 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid) struct batadv_softif_vlan *vlan; int err;
+ vlan = batadv_softif_vlan_get(bat_priv, vid); + if (vlan) { + batadv_softif_vlan_free_ref(vlan); + return -EEXIST; + } + vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC); if (!vlan) return -ENOMEM;