hash: fix use after free in Toeplitz hash

This patch fixes use after free in thash library, reported by ASAN.

Bugzilla ID: 868
Fixes: 28ebff11c2 ("hash: add predictable RSS")
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Vladimir Medvedkin 2021-10-29 15:54:59 +01:00 committed by Thomas Monjalon
parent 7dc627426e
commit adeca6685f

View File

@ -468,10 +468,10 @@ insert_before(struct rte_thash_ctx *ctx,
return ret;
}
} else if ((next_ent != NULL) && (end > next_ent->offset)) {
rte_free(ent);
RTE_LOG(ERR, HASH,
"Can't add helper %s due to conflict with existing"
" helper %s\n", ent->name, next_ent->name);
rte_free(ent);
return -ENOSPC;
}
attach_lfsr(ent, cur_ent->lfsr);
@ -517,10 +517,10 @@ insert_after(struct rte_thash_ctx *ctx,
int ret;
if ((next_ent != NULL) && (end > next_ent->offset)) {
rte_free(ent);
RTE_LOG(ERR, HASH,
"Can't add helper %s due to conflict with existing"
" helper %s\n", ent->name, next_ent->name);
rte_free(ent);
return -EEXIST;
}