From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C17CFA0547; Fri, 29 Oct 2021 16:55:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A5F1F426E3; Fri, 29 Oct 2021 16:55:15 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 3D2F34111F for ; Fri, 29 Oct 2021 16:55:14 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10151"; a="230539519" X-IronPort-AV: E=Sophos;i="5.87,193,1631602800"; d="scan'208";a="230539519" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2021 07:55:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,193,1631602800"; d="scan'208";a="598230808" Received: from silpixa00400072.ir.intel.com ([10.237.222.213]) by orsmga004.jf.intel.com with ESMTP; 29 Oct 2021 07:55:12 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: Yipeng Wang , Sameh Gobriel , Bruce Richardson Date: Fri, 29 Oct 2021 15:54:59 +0100 Message-Id: <1635519300-458498-1-git-send-email-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] hash: fix use after free in thash X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes use after free in thash library, reported by ASAN. Bugzilla ID: 868 Fixes: 28ebff11c2dc ("hash: add predictable RSS") Signed-off-by: Vladimir Medvedkin --- lib/hash/rte_thash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 696a112..7a284a7 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -416,10 +416,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); @@ -465,10 +465,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; } -- 2.7.4