From f01b6fceac77d9649aed46daf231b334f6a9dc94 Mon Sep 17 00:00:00 2001 From: Mike Baucom Date: Thu, 10 Sep 2020 18:55:44 -0700 Subject: [PATCH] net/bnxt: free EM index on failure When a Exact Match entry fails insertion, the allocated index needs to be pushed back to the allocation stack. This patch takes care of that. Signed-off-by: Mike Baucom Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_em_internal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c index 462d0fa769..c95515b1bf 100644 --- a/drivers/net/bnxt/tf_core/tf_em_internal.c +++ b/drivers/net/bnxt/tf_core/tf_em_internal.c @@ -175,8 +175,11 @@ tf_em_insert_int_entry(struct tf *tfp, &rptr_index, &rptr_entry, &num_of_entries); - if (rc) + if (rc) { + /* Free the allocated index before returning */ + stack_push(pool, index); return -1; + } PMD_DRV_LOG (DEBUG, -- 2.20.1