From: Antonio Quartulli antonio@open-mesh.com
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 --- soft-interface.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/soft-interface.c b/soft-interface.c index d018c49..2459967 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -450,6 +450,10 @@ 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) + return -EEXIST; + vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC); if (!vlan) return -ENOMEM;