hash: fix missing spinlock unlock in add key
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Sun, 4 Mar 2018 14:58:31 +0000 (20:28 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 10 Apr 2018 21:35:40 +0000 (23:35 +0200)
Fix missing spinlock unlock during add key when key is already present.

Fixes: be856325cba3 ("hash: add scalable multi-writer insertion with Intel TSX")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
lib/librte_hash/rte_cuckoo_hash.c

index 9b1387b..a07543a 100644 (file)
@@ -552,7 +552,8 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,
                                 * Return index where key is stored,
                                 * subtracting the first dummy index
                                 */
-                               return prim_bkt->key_idx[i] - 1;
+                               ret = prim_bkt->key_idx[i] - 1;
+                               goto failure;
                        }
                }
        }
@@ -572,7 +573,8 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,
                                 * Return index where key is stored,
                                 * subtracting the first dummy index
                                 */
-                               return sec_bkt->key_idx[i] - 1;
+                               ret = sec_bkt->key_idx[i] - 1;
+                               goto failure;
                        }
                }
        }