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

Message ID 20180304145831.26416-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh March 4, 2018, 2:58 p.m. UTC
  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>
---
 lib/librte_hash/rte_cuckoo_hash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

De Lara Guarch, Pablo March 14, 2018, 1:06 p.m. UTC | #1
> -----Original Message-----
> From: Pavan Nikhilesh [mailto:pbhagavatula@caviumnetworks.com]
> Sent: Sunday, March 4, 2018 2:59 PM
> To: jerin.jacob@caviumnetworks.com; Richardson, Bruce
> <bruce.richardson@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh
> <pbhagavatula@caviumnetworks.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] hash: fix missing spinlock unlock in add key
> 
> 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>
  
Thomas Monjalon April 10, 2018, 3:12 p.m. UTC | #2
> > 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>

Applied, thanks
  

Patch

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;
 			}
 		}
 	}