diff options
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index d636bde72c9a..5f59e7f899a0 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -511,6 +511,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
511 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); | 511 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); |
512 | struct batadv_tt_local_entry *tt_local; | 512 | struct batadv_tt_local_entry *tt_local; |
513 | struct batadv_tt_global_entry *tt_global = NULL; | 513 | struct batadv_tt_global_entry *tt_global = NULL; |
514 | struct batadv_softif_vlan *vlan; | ||
514 | struct net_device *in_dev = NULL; | 515 | struct net_device *in_dev = NULL; |
515 | struct hlist_head *head; | 516 | struct hlist_head *head; |
516 | struct batadv_tt_orig_list_entry *orig_entry; | 517 | struct batadv_tt_orig_list_entry *orig_entry; |
@@ -572,6 +573,9 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
572 | if (!tt_local) | 573 | if (!tt_local) |
573 | goto out; | 574 | goto out; |
574 | 575 | ||
576 | /* increase the refcounter of the related vlan */ | ||
577 | vlan = batadv_softif_vlan_get(bat_priv, vid); | ||
578 | |||
575 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 579 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
576 | "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n", | 580 | "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n", |
577 | addr, BATADV_PRINT_VID(vid), | 581 | addr, BATADV_PRINT_VID(vid), |
@@ -604,6 +608,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
604 | if (unlikely(hash_added != 0)) { | 608 | if (unlikely(hash_added != 0)) { |
605 | /* remove the reference for the hash */ | 609 | /* remove the reference for the hash */ |
606 | batadv_tt_local_entry_free_ref(tt_local); | 610 | batadv_tt_local_entry_free_ref(tt_local); |
611 | batadv_softif_vlan_free_ref(vlan); | ||
607 | goto out; | 612 | goto out; |
608 | } | 613 | } |
609 | 614 | ||
@@ -1009,6 +1014,7 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, | |||
1009 | { | 1014 | { |
1010 | struct batadv_tt_local_entry *tt_local_entry; | 1015 | struct batadv_tt_local_entry *tt_local_entry; |
1011 | uint16_t flags, curr_flags = BATADV_NO_FLAGS; | 1016 | uint16_t flags, curr_flags = BATADV_NO_FLAGS; |
1017 | struct batadv_softif_vlan *vlan; | ||
1012 | 1018 | ||
1013 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); | 1019 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); |
1014 | if (!tt_local_entry) | 1020 | if (!tt_local_entry) |
@@ -1039,6 +1045,11 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, | |||
1039 | hlist_del_rcu(&tt_local_entry->common.hash_entry); | 1045 | hlist_del_rcu(&tt_local_entry->common.hash_entry); |
1040 | batadv_tt_local_entry_free_ref(tt_local_entry); | 1046 | batadv_tt_local_entry_free_ref(tt_local_entry); |
1041 | 1047 | ||
1048 | /* decrease the reference held for this vlan */ | ||
1049 | vlan = batadv_softif_vlan_get(bat_priv, vid); | ||
1050 | batadv_softif_vlan_free_ref(vlan); | ||
1051 | batadv_softif_vlan_free_ref(vlan); | ||
1052 | |||
1042 | out: | 1053 | out: |
1043 | if (tt_local_entry) | 1054 | if (tt_local_entry) |
1044 | batadv_tt_local_entry_free_ref(tt_local_entry); | 1055 | batadv_tt_local_entry_free_ref(tt_local_entry); |
@@ -1111,6 +1122,7 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) | |||
1111 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 1122 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
1112 | struct batadv_tt_common_entry *tt_common_entry; | 1123 | struct batadv_tt_common_entry *tt_common_entry; |
1113 | struct batadv_tt_local_entry *tt_local; | 1124 | struct batadv_tt_local_entry *tt_local; |
1125 | struct batadv_softif_vlan *vlan; | ||
1114 | struct hlist_node *node_tmp; | 1126 | struct hlist_node *node_tmp; |
1115 | struct hlist_head *head; | 1127 | struct hlist_head *head; |
1116 | uint32_t i; | 1128 | uint32_t i; |
@@ -1131,6 +1143,13 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) | |||
1131 | tt_local = container_of(tt_common_entry, | 1143 | tt_local = container_of(tt_common_entry, |
1132 | struct batadv_tt_local_entry, | 1144 | struct batadv_tt_local_entry, |
1133 | common); | 1145 | common); |
1146 | |||
1147 | /* decrease the reference held for this vlan */ | ||
1148 | vlan = batadv_softif_vlan_get(bat_priv, | ||
1149 | tt_common_entry->vid); | ||
1150 | batadv_softif_vlan_free_ref(vlan); | ||
1151 | batadv_softif_vlan_free_ref(vlan); | ||
1152 | |||
1134 | batadv_tt_local_entry_free_ref(tt_local); | 1153 | batadv_tt_local_entry_free_ref(tt_local); |
1135 | } | 1154 | } |
1136 | spin_unlock_bh(list_lock); | 1155 | spin_unlock_bh(list_lock); |
@@ -3139,6 +3158,7 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) | |||
3139 | struct batadv_hashtable *hash = bat_priv->tt.local_hash; | 3158 | struct batadv_hashtable *hash = bat_priv->tt.local_hash; |
3140 | struct batadv_tt_common_entry *tt_common; | 3159 | struct batadv_tt_common_entry *tt_common; |
3141 | struct batadv_tt_local_entry *tt_local; | 3160 | struct batadv_tt_local_entry *tt_local; |
3161 | struct batadv_softif_vlan *vlan; | ||
3142 | struct hlist_node *node_tmp; | 3162 | struct hlist_node *node_tmp; |
3143 | struct hlist_head *head; | 3163 | struct hlist_head *head; |
3144 | spinlock_t *list_lock; /* protects write access to the hash lists */ | 3164 | spinlock_t *list_lock; /* protects write access to the hash lists */ |
@@ -3167,6 +3187,12 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) | |||
3167 | tt_local = container_of(tt_common, | 3187 | tt_local = container_of(tt_common, |
3168 | struct batadv_tt_local_entry, | 3188 | struct batadv_tt_local_entry, |
3169 | common); | 3189 | common); |
3190 | |||
3191 | /* decrease the reference held for this vlan */ | ||
3192 | vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); | ||
3193 | batadv_softif_vlan_free_ref(vlan); | ||
3194 | batadv_softif_vlan_free_ref(vlan); | ||
3195 | |||
3170 | batadv_tt_local_entry_free_ref(tt_local); | 3196 | batadv_tt_local_entry_free_ref(tt_local); |
3171 | } | 3197 | } |
3172 | spin_unlock_bh(list_lock); | 3198 | spin_unlock_bh(list_lock); |