Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp21774pxb; Fri, 15 Jan 2021 04:56:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyqnqTbcgc0MMJhyAj71elAHfyaxWD1l6kIhwlljFaYWCXjuL10M2i4cKb8qiQgueQwo2I X-Received: by 2002:aa7:c707:: with SMTP id i7mr9427069edq.183.1610715362012; Fri, 15 Jan 2021 04:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715362; cv=none; d=google.com; s=arc-20160816; b=uppNb4rpjYmpo+x8cNag02Nuihrt+JxnVRHirBA1ayfcfmgm/masP2j4CUtfIr+Oj1 xv7OdH0JKChQOSB/bWEiXoIEIF7RyxJVCBsIw2AA+QpM7hmpbmxS89uw9Nq8VZmGQZ2H cEXkxiz1AQkrevpGWCSg1qGlZhDYkdLhVPySsUIfaqEjQa9JWCFez+3xkgkNIxEh5/QX A/G3b3PCQrjpxTfLl68YDGZZA5cNU7dbSjQPji9FvPkAYkZII6EHKCy7Zi/cuX19Nzbg z7nYkDQ9S1BJx3ZVvP5ypBafEss8v09Ob6jYcBQMnoLADr4frVuJ20dt939oCByF6BWS Dh1Q== 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=YnZBDIB/zAruPcHyd3EBMaTVF02vqH0pUTx/DG3AjnE=; b=XBhmOm8DMcB9lAAElW7SbNz5xIgR72I2P5cDmBznjNFj9nrWeAt2e1CtMwTq6ZdsOc /o2kqrYunMRInvMIh6qhUJVQ4M3Er5S0xcLBGq8yTzIyfhTtMvcgyTeIjJd6EgY9Hu3z G6NKi3mySw7a5eEsAcw2xo0pw8uBHw0SDsiy9bZEpH7/ZF8nXm48yy0YR1lPFZhgogF+ 5ZnkwaiLWDPh5nxfLu+7CfV4H0tnY3X7h1PFlqiGxrcMamWpdxrhI+rFtdYdM+0IxX66 d7Z6p7prEwNFpepBYZErzLsixqvG8TmExiqotg29HXtBTsXydRIkUv07OJVux2GZTSY1 MtTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NXHyMLOk; 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 v13si3765371ejf.621.2021.01.15.04.55.38; Fri, 15 Jan 2021 04:56:01 -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=NXHyMLOk; 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 S2387886AbhAOMyp (ORCPT + 99 others); Fri, 15 Jan 2021 07:54:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:42246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387670AbhAOMfb (ORCPT ); Fri, 15 Jan 2021 07:35:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E60742333E; Fri, 15 Jan 2021 12:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714116; bh=3qj1XT4JF/OLljUzGJPB1ccTlERMnieAxKgwnFFaGKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXHyMLOk/TjkagMUAcodXJLBVEjvNrGwlt5kswuNM2fCcT7Oc0dhuu+RZceHf7QMV 9bkY+nx35/bUIbXBysA5LfA8ZHrjd7O64H+dv3MIv6I9BvWm7VIqVRTGmaFIMxu9oJ +yELRedRCJ87AbFvvhRiw1CZvqoECeSEwnh46gJE= 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 54/62] net/mlx5e: Fix two double free cases Date: Fri, 15 Jan 2021 13:28:16 +0100 Message-Id: <20210115122001.001805010@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 7a6eb072a9548492ead086f3e820e9aac71c7138 upstream. mlx5e_create_ttc_table_groups() frees ft->g on failure of kvzalloc(), but such failure will be caught by its caller in mlx5e_create_ttc_table() and ft->g will be freed again in mlx5e_destroy_flow_table(). The same issue also occurs in mlx5e_create_ttc_table_groups(). Set ft->g to NULL after kfree() to avoid double free. Fixes: 7b3722fa9ef6 ("net/mlx5e: Support RSS for GRE tunneled packets") 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 | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -927,6 +927,7 @@ static int mlx5e_create_ttc_table_groups in = kvzalloc(inlen, GFP_KERNEL); if (!in) { kfree(ft->g); + ft->g = NULL; return -ENOMEM; } @@ -1067,6 +1068,7 @@ static int mlx5e_create_inner_ttc_table_ in = kvzalloc(inlen, GFP_KERNEL); if (!in) { kfree(ft->g); + ft->g = NULL; return -ENOMEM; }