[dpdk-dev] [PATCH] hash: fix missing spinlock unlock in add key

Pavan Nikhilesh pbhagavatula at caviumnetworks.com
Sun Mar 4 15:58:31 CET 2018


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 at dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula at caviumnetworks.com>
---
 lib/librte_hash/rte_cuckoo_hash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 9b1387b5e..a07543a29 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -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;
 			}
 		}
 	}
-- 
2.16.2



More information about the dev mailing list