Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6181458iog; Thu, 23 Jun 2022 13:04:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLxJsdM29JZDm3x6sOk07fbnjsBBCftXMEfF/hs4jFOMQT9ntM7cZslEOzR8YAPZKLnx2d X-Received: by 2002:a05:6a00:2390:b0:51c:21e1:782 with SMTP id f16-20020a056a00239000b0051c21e10782mr42488827pfc.21.1656014665662; Thu, 23 Jun 2022 13:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656014665; cv=none; d=google.com; s=arc-20160816; b=WqK8HzJk+hMq0brQDebRyskyz6NTptB2if9AOHOYWlqWYHa4Z51VQbwsHSHCm/ZjpX dyQla3kWMii02CERrQ8x+l8u/5oD7RixkPjA0GcSWGhj3exBTcQQQODQZOJPVL0AnS1v f25oaguPumZULd0ibgVQVtG1ApUcHv0wWcGqUiPYmP/39mQHikt8zOQCaYbCrMh/MWhJ thTbAGjNIAbdi1xnH9Z/FMvNOzLPAkkjdEod/qsCxmfyeR1fTYvscJCUy9YXLTsztzac RZHPPJBPt9u3537toRBi1OiYBHM3Ai7LxCzA1VhbkSvHPd/0SMcxve1F+MPkeMsv2FlF K8jA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=eB0y+5wvVhC1E2pIqOzXjt1stIm8/4fHry57V9SA5ts=; b=VQ0LIPqkXfDYAQ2FwslkBQBZ5LpqCygMgdkNGO7nq/S8tkrMkdcnVlrIuskscftAik XD/hMS9suo2jgDO2iGZI66Rk4l0B+mf/xif9Qw5kUIzzkceG/b95p2H+b+10hKQfDlDr +0CPCfLN0wwwPOgHpU1yMrvkVoDXD35nLMgt9DyH05G7TKfA6sm9qUYDhJiWxKzGEFUD i3tRmL/xY/vYeuU45HJXarVzFbaRfiF9FgxXZWWuWEFOc+bvs5QUyGK78PfMrq5qzS6s 2klowRPwOYvaEeOkDp5tP/AuzU8q9tQ8fqk8VigaRzqFv//G1AL8Ch/aUt6GFr2AGSRP RHRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uuir36Ea; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h189-20020a6383c6000000b003fd2602496esi97813pge.256.2022.06.23.13.04.14; Thu, 23 Jun 2022 13:04:25 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uuir36Ea; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230454AbiFWTeT (ORCPT + 99 others); Thu, 23 Jun 2022 15:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbiFWTde (ORCPT ); Thu, 23 Jun 2022 15:33:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F8E34EDFA; Thu, 23 Jun 2022 12:14:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EA2E4B824BD; Thu, 23 Jun 2022 19:14:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BD72C341C0; Thu, 23 Jun 2022 19:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656011670; bh=wC/mFFOXrER8itkfHbAsJlzoussVbkCh7WfuQkWX524=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Uuir36EaxLJoFbQNhTM3TJD0TQfF9zlezPxAKPYt05pIDsPDlyU9JhpvtPJceomx+ EBCHpxQgx59JsnVOVGJAnjEM5tAdsD+fzelCIqHSbMd7vyjGkMYJG7Qocuw9cJaZRb JvalXj+2PXrN2eSOqaJMSyPrfDmtFB7JlvWesQPR4saJpgDirsRxf1j67tCsz2fsk8 0/V3GUER1ZlLysdquV50C0YuYlOUwzRTKBxtTjkp7jg94n4RXRwn9XrvCSmy7VoQQZ b/4YjlLKtmx23DzBdNYYN5gN8udxWdt5B7wAW6S3z/KTjLa37cFV8PfNKRVA6V31OJ 8X3w4AOIj5f3g== Date: Thu, 23 Jun 2022 12:14:21 -0700 From: Jakub Kicinski To: Jianglei Nie Cc: linux@armlinux.org.uk, andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: sfp: fix memory leak in sfp_probe() Message-ID: <20220623121421.3bc054d2@kernel.org> In-Reply-To: <20220623070914.1781700-1-niejianglei2021@163.com> References: <20220623070914.1781700-1-niejianglei2021@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 On Thu, 23 Jun 2022 15:09:14 +0800 Jianglei Nie wrote: > sfp_probe() allocates a memory chunk from sfp with sfp_alloc(), when > devm_add_action() fails, sfp is not freed, which leads to a memory leak. > > We should free the sfp with sfp_cleanup() when devm_add_action() fails. .. and please add a Fixes tag