diff options
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index cd8a58396d26..8d15b48d1692 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -589,17 +589,20 @@ void hna_global_free(struct bat_priv *bat_priv) | |||
589 | struct orig_node *transtable_search(struct bat_priv *bat_priv, uint8_t *addr) | 589 | struct orig_node *transtable_search(struct bat_priv *bat_priv, uint8_t *addr) |
590 | { | 590 | { |
591 | struct hna_global_entry *hna_global_entry; | 591 | struct hna_global_entry *hna_global_entry; |
592 | struct orig_node *orig_node = NULL; | ||
592 | 593 | ||
593 | spin_lock_bh(&bat_priv->hna_ghash_lock); | 594 | spin_lock_bh(&bat_priv->hna_ghash_lock); |
594 | hna_global_entry = hna_global_hash_find(bat_priv, addr); | 595 | hna_global_entry = hna_global_hash_find(bat_priv, addr); |
595 | 596 | ||
596 | if (hna_global_entry) | 597 | if (!hna_global_entry) |
597 | kref_get(&hna_global_entry->orig_node->refcount); | 598 | goto out; |
598 | 599 | ||
599 | spin_unlock_bh(&bat_priv->hna_ghash_lock); | 600 | if (!atomic_inc_not_zero(&hna_global_entry->orig_node->refcount)) |
601 | goto out; | ||
600 | 602 | ||
601 | if (!hna_global_entry) | 603 | orig_node = hna_global_entry->orig_node; |
602 | return NULL; | ||
603 | 604 | ||
604 | return hna_global_entry->orig_node; | 605 | out: |
606 | spin_unlock_bh(&bat_priv->hna_ghash_lock); | ||
607 | return orig_node; | ||
605 | } | 608 | } |