From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7303713AC4 for ; Wed, 5 Jul 2023 17:58:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0765C433C7; Wed, 5 Jul 2023 17:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688579896; bh=lvm7QCPfN9SheaRCpR/H++5WVkAoN/AJof5ylAnX7ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXdJ/H1OEmprbu/KgldZxaeKM/CzbiAIW80cGpLGyFMmi3xnejgLExwa2f749xUON Rs53IsYFvy28AHv6MrDq5vhzxMbT9hzY93dybHazyI6TbtLdQDq9dglrZ5CuXWRl1B GHUomuBSseLfw358fz3Wqcr+kgFQ3ttlWkQIQjgI7dvp8H06wwBzO3XKdVL/h4cEAW E6MVeiKBdOTB+YVPKydxXh2Oa8GrUN6pai2ytFgMfdPZBoQCSFiRy6j/zGnldQTWCi qTUQLGuyH0aV4t0aPGrDJH2oo/BOLVox/oM+8eWcUVn9lQeOcgnDW5MV7qkw9h1LTX PtQaPw+tdEmKQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Zhengchao Shao Subject: [net V2 1/9] net/mlx5e: fix double free in mlx5e_destroy_flow_table Date: Wed, 5 Jul 2023 10:57:49 -0700 Message-ID: <20230705175757.284614-2-saeed@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705175757.284614-1-saeed@kernel.org> References: <20230705175757.284614-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Zhengchao Shao In function accel_fs_tcp_create_groups(), when the ft->g memory is successfully allocated but the 'in' memory fails to be allocated, the memory pointed to by ft->g is released once. And in function accel_fs_tcp_create_table, mlx5e_destroy_flow_table is called to release the memory pointed to by ft->g again. This will cause double free problem. Fixes: c062d52ac24c ("net/mlx5e: Receive flow steering framework for accelerated TCP flows") Signed-off-by: Zhengchao Shao Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c index 88a5aed9d678..c7d191f66ad1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/fs_tcp.c @@ -190,6 +190,7 @@ static int accel_fs_tcp_create_groups(struct mlx5e_flow_table *ft, in = kvzalloc(inlen, GFP_KERNEL); if (!in || !ft->g) { kfree(ft->g); + ft->g = NULL; kvfree(in); return -ENOMEM; } -- 2.41.0