From patchwork Fri Sep 25 12:47:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 309201 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=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,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 7BAB9C4727D for ; Fri, 25 Sep 2020 12:58:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DA072072E for ; Fri, 25 Sep 2020 12:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038687; bh=IVhxxjkyCwp0Kcn8Rl7vIe6uy1bQQKhwMpGCiEwFruw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TtklCxt0o3x8inoyGvqVsJiKnUm17urQlVwKBx3BlQCFa62VEzAS5oHptPevA7keW /w1MUT/PBdAAGRPwArrnzFcr8PZCy/WEJzVWCniaBAKceWwZuRd69+kP0vZtIHLHg4 0+jaVcgIQ43NJ9nE20z1zBEcj6eZ7879eSwdsjyw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728954AbgIYM6G (ORCPT ); Fri, 25 Sep 2020 08:58:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:53552 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728951AbgIYMtr (ORCPT ); Fri, 25 Sep 2020 08:49:47 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 109C021741; Fri, 25 Sep 2020 12:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038187; bh=IVhxxjkyCwp0Kcn8Rl7vIe6uy1bQQKhwMpGCiEwFruw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktRDDqnNDLqXbm2PGtzWgdVA61YfPqgdCR144eGjVfiMpa/qGdFbhUOPzIVuhUTdN 3Js9mwgqJEfSdZ04aPQXITmlvAvHqQ0QoGgY9ArE7RdYvf2J6W0XJMvTKLyi2epl4v jc6H+qdHxEPmaAcTHso05hSuEOO0NWidBnA7NaUE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raju Rangoju , "David S. Miller" Subject: [PATCH 5.8 06/56] cxgb4: fix memory leak during module unload Date: Fri, 25 Sep 2020 14:47:56 +0200 Message-Id: <20200925124728.808796966@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124727.878494124@linuxfoundation.org> References: <20200925124727.878494124@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Raju Rangoju [ Upstream commit f4a26a9b311d7ff9db461278faf2869d06496ef8 ] Fix the memory leak in mps during module unload path by freeing mps reference entries if the list adpter->mps_ref is not already empty Fixes: 28b3870578ef ("cxgb4: Re-work the logic for mps refcounting") Signed-off-by: Raju Rangoju Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c @@ -229,7 +229,7 @@ void cxgb4_free_mps_ref_entries(struct a { struct mps_entries_ref *mps_entry, *tmp; - if (!list_empty(&adap->mps_ref)) + if (list_empty(&adap->mps_ref)) return; spin_lock(&adap->mps_ref_lock);