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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,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 48F31C32750 for ; Wed, 14 Aug 2019 02:17:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15F402085A for ; Wed, 14 Aug 2019 02:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565749042; bh=b0cyxILcfBsyyOPYLfYcgmt967qYJ2hx0cEuZI7u1bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PMdO+9UoZobDpvhHnqi1Tv5GWqs2M7VfQu2s6g7rgbu9t7i6q3JYJztrw7bY4dr+m HgtW6lPYaVcGeyDUcExGDJ2EydtLLCKZr6zHi8BHIDEyDeT/bl0xHbCklzuACvmEIN VwNWvLkMpX64xzQUm/Eh/CWV06iHTdmtOJFFQLRg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729361AbfHNCRV (ORCPT ); Tue, 13 Aug 2019 22:17:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:48640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729345AbfHNCRS (ORCPT ); Tue, 13 Aug 2019 22:17:18 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E824D20843; Wed, 14 Aug 2019 02:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565749037; bh=b0cyxILcfBsyyOPYLfYcgmt967qYJ2hx0cEuZI7u1bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1mOTHjBJsN3jJ3A/8kHPCL+dHljHFU7lmKTlyBjP15xaHWSBlnQAA5JLTT44zzBYn fyUP0u4QgAsMRjdW4ijGFDzuo5V5jbzR2nVChl9zXIouPYWvwM2YsCNeEbCztlqAXx g8Tqr7CnkJsF8kN2SqHWhOrmcJGFp53+TUFJzeu0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 52/68] net: cxgb3_main: Fix a resource leak in a error path in 'init_one()' Date: Tue, 13 Aug 2019 22:15:30 -0400 Message-Id: <20190814021548.16001-52-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190814021548.16001-1-sashal@kernel.org> References: <20190814021548.16001-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Christophe JAILLET [ Upstream commit debea2cd3193ac868289e8893c3a719c265b0612 ] A call to 'kfree_skb()' is missing in the error handling path of 'init_one()'. This is already present in 'remove_one()' but is missing here. Signed-off-by: Christophe JAILLET Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index c34ea385fe4a5..6be6de0774b61 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -3270,7 +3270,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (!adapter->regs) { dev_err(&pdev->dev, "cannot map device registers\n"); err = -ENOMEM; - goto out_free_adapter; + goto out_free_adapter_nofail; } adapter->pdev = pdev; @@ -3398,6 +3398,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (adapter->port[i]) free_netdev(adapter->port[i]); +out_free_adapter_nofail: + kfree_skb(adapter->nofail_skb); + out_free_adapter: kfree(adapter); -- 2.20.1