From patchwork Fri Jan 15 12:28:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364545 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=unavailable 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 BEE35C4332D for ; Fri, 15 Jan 2021 13:03:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A114D2256F for ; Fri, 15 Jan 2021 13:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732908AbhAOMcB (ORCPT ); Fri, 15 Jan 2021 07:32:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:36246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732902AbhAOMcA (ORCPT ); Fri, 15 Jan 2021 07:32:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9BD42339D; Fri, 15 Jan 2021 12:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713905; bh=yyKG51TFr5nmyyBWUHygy67mu7D8MjIYdZJXAt2amRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4vlsCG986xQT/iGOLIIDIcZPtyyiBZcVgfzsyA+DyZ7oRU6tfVCUVz9v4fm4aG59 rnbNM6lveDS2KO/G+fePGOMgneie4FR1qAF93V6aPo94JU24mg07XjIHqwrc2qmDHQ sMJw9DzB8hGXptSLOdE6NNxB+B4DgttLlavwanDI= 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.14 23/28] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Date: Fri, 15 Jan 2021 13:28:00 +0100 Message-Id: <20210115121957.908836920@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -1226,6 +1226,7 @@ err_destroy_groups: ft->g[ft->num_groups] = NULL; mlx5e_destroy_groups(ft); kvfree(in); + kfree(ft->g); return err; }