From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07762C433E0 for ; Fri, 15 Jan 2021 13:00:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC889221FA for ; Fri, 15 Jan 2021 13:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388428AbhAONAn (ORCPT ); Fri, 15 Jan 2021 08:00:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:39910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733103AbhAOMdP (ORCPT ); Fri, 15 Jan 2021 07:33:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5F062333E; Fri, 15 Jan 2021 12:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713980; bh=LFTYau8M+cMDsOX9ghPP/HnmP37U8Zuhpai/TdlNM4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VzF5wfE9R4hSRpl3lZOUhVrW2UhRWRH+y/GC5PSVst80AvjVRVHPUSSvoSnTInttZ x72Th0tE0ViowI1niKkURgnoW+Tc3MKSw6pOu1V2VRJGGsueKfIyumWgyoaLGyDU5R Xvm1ijlrdZONfaKeUZ7QU2OcejPZEEByHo6iT/ao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Leon Romanovsky , Saeed Mahameed Subject: [PATCH 4.19 36/43] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Date: Fri, 15 Jan 2021 13:28:06 +0100 Message-Id: <20210115121958.792475169@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121957.037407908@linuxfoundation.org> References: <20210115121957.037407908@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu commit 5b0bb12c58ac7d22e05b5bfdaa30a116c8c32e32 upstream. When mlx5_create_flow_group() fails, ft->g should be freed just like when kvzalloc() fails. The caller of mlx5e_create_l2_table_groups() does not catch this issue on failure, which leads to memleak. Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table") Signed-off-by: Dinghao Liu Reviewed-by: Leon Romanovsky Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -1312,6 +1312,7 @@ err_destroy_groups: ft->g[ft->num_groups] = NULL; mlx5e_destroy_groups(ft); kvfree(in); + kfree(ft->g); return err; }