Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp19657pxb; Fri, 15 Jan 2021 04:52:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyB3UZUvp3Q15JTE/aj+cZ9mN1xrVfhoK6/KiXug2IkTsf5fp9eF0EiUCJXnt5eFmk0a8AF X-Received: by 2002:a17:906:2755:: with SMTP id a21mr8886060ejd.374.1610715120610; Fri, 15 Jan 2021 04:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715120; cv=none; d=google.com; s=arc-20160816; b=n4m8QjvyIyicDfQrdlLYw2YgTXGkqH/hFWvNeCDiKLshiwFx8iGeEQkSIkyqrpY4Kd vKVVW/3PfHqmbq2f3auO8QyaRRC7fqcwPg842vYAZiwVXR+R1uf7uDmcYchaLGp3s1+F 3rVoB6DGw2+2LsT4rhuRZifcr7IX1XwtyiQzLwzSlNfpOKA454ytIj5JwznjIkI5uLx5 ooG6Y0b+p69MR14CIZ2W2oHADqjS+AGE0wI4RRJPuSrsyvgF7nn4OEPnNbHPINDbqMxH CVj00/IOG0OqLZGpHQlfH48eZUR9QKc3ZpZpWpvpVht+SFIngSH61UO5jB/y6IDz0UGM 7uOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TgR6OQAg91Ar9otaZO4Mzc1ZE8ZumIE5ar/yIXh/OeA=; b=QMinlp3fGA7MrRW1hI5hHxuJ+9wbKk/3zYXog/MzXZWGE/Nttd1G+iLAYUfwzu7isk d2n1X0nY/7jwc9QoPDjMb2PqVItSYsYAAyBvHTnfvLIdwSuC5OyWk/qF5ePYGNUD6vYQ 4uT0x3g7vYaswYzdfWw2rr0Ri//grzfanwsbazrFVclSRtOOcl1Q0dtuE3MLcmolrjF6 IC/SpEcEjM7tH7qoh5XsxxDA7lZ2VOieHFp2R1OfhxZ2BMx6Zv3cPi6RMKUaEMRcCFJd ixZKS+cs3hCp0A39LobAELyfSxC1vBxuS7LKLdmpzX1vAgTcE6E0o/DuYxuXi7rIE9Jw CCVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iJcU0l7m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si4322434edi.560.2021.01.15.04.51.36; Fri, 15 Jan 2021 04:52:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iJcU0l7m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387927AbhAOMun (ORCPT + 99 others); Fri, 15 Jan 2021 07:50:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:42952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387823AbhAOMgH (ORCPT ); Fri, 15 Jan 2021 07:36:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56A00207C4; Fri, 15 Jan 2021 12:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714151; bh=DI5UL3pn0UfozUlu804hzO6HXm4kw6L72vj/b0BHaxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJcU0l7mGO3hV2YL8Vhvtnb/aszROTq20G4Zm+lBGB4wdubDnOb2SETzjzt373NxE GVeGT/kj/2eQCJf8f0bx1PavGRQgSY65B80MeoD3mbqeVEvN1ZJmCisa9DM+HyqaSi +8XLDRNWv7rJ8bNp0vD9kAmdxQW5sZ5wcK6YO6YI= 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 5.4 53/62] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Date: Fri, 15 Jan 2021 13:28:15 +0100 Message-Id: <20210115122000.953360322@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -1346,6 +1346,7 @@ err_destroy_groups: ft->g[ft->num_groups] = NULL; mlx5e_destroy_groups(ft); kvfree(in); + kfree(ft->g); return err; }