Skip to content

Commit

Permalink
hash: fix use after free in Toeplitz hash
Browse files Browse the repository at this point in the history
This patch fixes use after free in thash library, reported by ASAN.

Bugzilla ID: 868
Fixes: 28ebff1 ("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>
  • Loading branch information
vmedvedk authored and tmonjalo committed Nov 4, 2021
1 parent 7dc6274 commit adeca66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hash/rte_thash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit adeca66

Please sign in to comment.