In case of hash_add failure tt_global_add() must return 0 (which means on entry insertion).
Signed-off-by: Antonio Quartulli ordex@autistici.org ---
This patch is based on master. This bug exists since "a bit" but nobody actually found it because this bug should have been triggered in the unlikely case of hash adding failure. Therefore I do not think it is a crucial bug and it is not worth sending this patch to stable.
Cheers,
translation-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/translation-table.c b/translation-table.c index 112edd3..eb352db 100644 --- a/translation-table.c +++ b/translation-table.c @@ -788,13 +788,13 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, batadv_dbg(BATADV_DBG_TT, bat_priv, "Creating new global tt entry: %pM (via %pM)\n", tt_global_entry->common.addr, orig_node->orig); + ret = 1;
out_remove: /* remove address from local hash if present */ batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr, "global tt received", flags & BATADV_TT_CLIENT_ROAM); - ret = 1; out: if (tt_global_entry) batadv_tt_global_entry_free_ref(tt_global_entry);