Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1698834rdb; Thu, 7 Dec 2023 06:39:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIaELzGHk+sJPCwjWo+BtqbDbdGJGrF893PN0G5qY/zqz4zaJjGLvT3qM3JnpP7xxoOUi7 X-Received: by 2002:a17:902:f686:b0:1d0:ba41:1ec with SMTP id l6-20020a170902f68600b001d0ba4101ecmr3142157plg.49.1701959966691; Thu, 07 Dec 2023 06:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701959966; cv=none; d=google.com; s=arc-20160816; b=Mcps6W1mgf1+ki/1NFwOGrrtJkU/SP2ECtJb+3EyI29HhJaObvXWpG3IxPRbwIRtyv UC1gZ5gPJUkCHWYvKgZ61OECuHxJYM72kjrqEt34rzvvKn3aW5OwaIlOrdzDP5c1BF3d gYTiFT/b0KgzayOFltnPwJY1/lMltnSrVCSuc8uQWwD3biouWWPYoGOu83H8xThofkyZ +Mnlgu8wR0WC7mosbFZFICPMKzBkGJS4X8ZVDE4kmo9NViFYg+QYFStRAcWNDhN1Pj+j HcTqiADl+EWvUCbKye3OdaJIg5j2k/DIzOA+8y8GWIzNeMxGIqw9wfq1QC7C2jK8+hHT 721Q== 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 :message-id:date:subject:cc:to:from; bh=zacuxTmSId9qy32Lr9jCJyDDJdKZ9Gxy0wz10v2IAns=; fh=7dBhDwlLSu4LpNvs6Ci/8kzDCbY2AHDy/bapchU2IsY=; b=nBFdZ+j9zLYed81c3BDJrLr58Hw0KCX13lBU/cjKsv1e1Sg9ExC9RwszIWmse0O9gt WagHuhsGcHElSx7BuxCsk3ry5hfd4bQp3dVw8e4DJLFi5XJY0Js/8MjIEniuD68H/xiO MriuopfOki0FGLF1gVvjMLoOPQjjz0LQu83nOn8etHl2pJWoZX850CAuo9KfaE1kON1P NLTFdGHdW2ViHOoUettzWW8gyg0YKipolDofaFqmliVd0gTbJhO1nBhmC1EZbN2yulbW 1QRW1dZfkqec1rr+zZwvIT+KuK/ttBDRxTRuyPiFpsIhTFoDtQdR7ecUcBhOHZ6PQTzo /gdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id c13-20020a170902d48d00b001cfb65f4c9asi1240302plg.570.2023.12.07.06.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 06:39:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4BC2C80BB22D; Thu, 7 Dec 2023 06:39:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443309AbjLGOjI (ORCPT + 99 others); Thu, 7 Dec 2023 09:39:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235280AbjLGOjH (ORCPT ); Thu, 7 Dec 2023 09:39:07 -0500 Received: from zg8tmtyylji0my4xnjqumte4.icoremail.net (zg8tmtyylji0my4xnjqumte4.icoremail.net [162.243.164.118]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 35B59AC; Thu, 7 Dec 2023 06:39:11 -0800 (PST) Received: from luzhipeng.223.5.5.5 (unknown [115.200.230.188]) by mail-app2 (Coremail) with SMTP id by_KCgDX3tb12HFlBRFZAA--.1750S2; Thu, 07 Dec 2023 22:38:46 +0800 (CST) From: Zhipeng Lu To: alexious@zju.edu.cn Cc: Chris Snook , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Yuanjun Gong , Jie Yang , Jeff Garzik , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ethernet: atheros: fix a memleak in atl1e_setup_ring_resources Date: Thu, 7 Dec 2023 22:38:19 +0800 Message-Id: <20231207143822.3358727-1-alexious@zju.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: by_KCgDX3tb12HFlBRFZAA--.1750S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GF1ruw4kGF17GrWDtF48tFb_yoWftrb_Kw 4xWw18uan8tr1jkw42yr4ru3yvk34DWrs5Ca97KFW3Zw47Aw17uwnYgrn3Xr12gr4fJFy3 Ar1aqr18Aa4DKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbx8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFyl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j 6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUdHU DUUUUU= X-CM-SenderInfo: qrsrjiarszq6lmxovvfxof0/ X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 07 Dec 2023 06:39:24 -0800 (PST) In the error handling of 'offset > adapter->ring_size', the tx_ring->tx_buffer allocated by kzalloc should be freed, instead of 'goto failed' instantly. Fixes: a6a5325239c2 ("atl1e: Atheros L1E Gigabit Ethernet driver") Signed-off-by: Zhipeng Lu --- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 5935be190b9e..deb5a3f207cc 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c @@ -866,6 +866,7 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter) netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n", offset, adapter->ring_size); err = -1; + kfree(tx_ring->tx_buffer); goto failed; } -- 2.34.1