Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp404117rwe; Wed, 19 Apr 2023 00:08:36 -0700 (PDT) X-Google-Smtp-Source: AKy350aZYiQJIjqvZKUq4CXHVelWqNKDcj7Nsfjgod8ZX8OHhgy/IKKfi6u1duvFY0CV1kuf1VMF X-Received: by 2002:a05:6870:c1cb:b0:177:a92e:ee6 with SMTP id i11-20020a056870c1cb00b00177a92e0ee6mr2813058oad.54.1681888116659; Wed, 19 Apr 2023 00:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681888116; cv=none; d=google.com; s=arc-20160816; b=ZYnYLkM8hCqTCVmzKYstdss97r9U4iJMS2esLBb35AOQhcz6dpoQFcys084jBgAYv0 9/GFqFuSXDVOINpx919+1ssFFnDuBPt60vAIPFOnBMhcpVZk4i1VHCBZWOYpoiIe/pIV n0GRWnfTSzMr8c0V6r4qs1RYrBQjDy7ZIZxGWgxIrxgFb5kdthU79aLsQ0ofr+ky5aKj IhAiYK9UpCo85TMciPzlgfGHgwOEs8TD8sN2jgKNMwutKnwH7shX0w4tZge9Qq2DgU6I 70R1SlyLcjLHpy+Kl9l0Wp7Mad6JJybBsPmypxJdPGai7t5JIiDvWX0W2GJtvAvqbJCk zUcA== 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=bQXuMLQjgPZk5wq3RUIaznf6GGBa6veSmqkX8xeyuIA=; b=wcsgp8lf3iCOSAHaRFAsJW2ZVyuI6lkMWN01yZzmE4HTZyQYMFdbJLzqdnoQnN52UH spPggJ8YfaFEM3pi8Uk9dM9SO/9V76zkEx//6kuYsT0spj60+bTKyAldE5R7bVoj7cVk RMUIVljFsmw/GfseGzUd59No+Xzeb7RU1hX7Yi14uaa2vI0JSh8S+UKftXN8su0CF4BD E6WV1GdhS66fd7H8213Sk22q+Y4r7ZANnQK4diIfSbeZfbHjKSTV2tKgOzHyg3Mnlid9 Of7ryfl79HdsNpT2om6ajynqvbjzy76YipwHS14b/JgQ4sR0Z1fKc1JTM+Zdyiqfa1bc vQAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p41-20020a0568708a2900b001878911eeb2si14501132oaq.252.2023.04.19.00.08.21; Wed, 19 Apr 2023 00:08:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbjDSG7x (ORCPT + 99 others); Wed, 19 Apr 2023 02:59:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231651AbjDSG7w (ORCPT ); Wed, 19 Apr 2023 02:59:52 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A45A3191; Tue, 18 Apr 2023 23:59:49 -0700 (PDT) Received: from liber-MS-7D42.. ([10.12.190.56]) (user=gangecen@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 33J6wv3g016111-33J6wv3h016111 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 19 Apr 2023 14:59:02 +0800 From: Gencen Gan To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: hust-os-kernel-patches@googlegroups.com, Gan Gecen , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: amd: Fix link leak when verifying config failed Date: Wed, 19 Apr 2023 14:58:29 +0800 Message-Id: <20230419065829.4077082-1-gangecen@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: gangecen@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gan Gecen After failing to verify configuration, it returns directly without releasing link, which may cause memory leak. Signed-off-by: Gan Gecen --- v1->v2: Fix the whitespace-damaged bug. drivers/net/ethernet/amd/nmclan_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/amd/nmclan_cs.c b/drivers/net/ethernet/amd/nmclan_cs.c index 823a329a921f..0dd391c84c13 100644 --- a/drivers/net/ethernet/amd/nmclan_cs.c +++ b/drivers/net/ethernet/amd/nmclan_cs.c @@ -651,7 +651,7 @@ static int nmclan_config(struct pcmcia_device *link) } else { pr_notice("mace id not found: %x %x should be 0x40 0x?9\n", sig[0], sig[1]); - return -ENODEV; + goto failed; } } -- 2.34.1