Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp421075iog; Wed, 29 Jun 2022 03:04:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t4sDydyjOHCHpLJYYi9T/IL4lE4AzO/BUeQXseZTy6QC8Hko5RcxAAYXCm6gpzpuWNKw/T X-Received: by 2002:a05:6402:d5e:b0:435:dc14:d457 with SMTP id ec30-20020a0564020d5e00b00435dc14d457mr3129908edb.58.1656497054942; Wed, 29 Jun 2022 03:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656497054; cv=none; d=google.com; s=arc-20160816; b=ND+FctJ4SJVxi5W8+RMXaio0xBxVybfkCwsPiLQ7rSaMAbqSz2FafX8nj/zE/GoZkI ESAD6Ut+PrsWLrUNVMUIJakgcGb845GfFJM1DMztFIF3Wqko6zdfskIX3RAH+c0qmtUB tsmKtQsTt7uEsBZszOlVI5V9Qkzo2MNRt5HQ/M0jHRMnr8IQj3Jkkh988RieU7l1PKr0 p9pYGn4FeanaJXLZpYbX3a7YSspQ12hgj+3TKw9hs2KDyr8gOyq0rEBIaXETiqMvCDzx Drle0em1EF8QZSSpCc6AUSRJuU4hrFjNCrfiCx4IpMbaKNU306gmzdPKQO9gSTZnR+gm dnlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=hTOUDEg4blfwUlQNzGC/+sYc9DIP+OWNGDmymLRC7EI=; b=WuaMQoSz82reRttaX/Y5A77RSLHYtGjbjOJyFPHuvmEm0zfczlqzf+dHyjkW5dE48c V13bBb+wUOBbOci5GCml2riQAHK1OSDNuZPOblQYOBDg/xOhZsCfTETO4egC2UhRwWle xlpLAZ5qQjVZpvGYbLPmW+EcHHwEylFZw0tJbL+RVG3xIujh1xkO3ys6hqi3X9o3SMvx KmbSn2yFDIUZ+NL/3yCOWeGlSOl60cOasooeMFWGeFnjmY34crCm48QIMcOjvlKsQVhh ezHQNMBo8YqEOtOZbaoE5uCpJKYIITh1wbzL6weqfWhZUTtzYSVOfXZkySySYVG3EPl4 BVpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=oTtVDKJb; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v3-20020aa7d803000000b004359684a3a6si4729643edq.533.2022.06.29.03.03.50; Wed, 29 Jun 2022 03:04:14 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=oTtVDKJb; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233049AbiF2JoJ (ORCPT + 99 others); Wed, 29 Jun 2022 05:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232626AbiF2JoF (ORCPT ); Wed, 29 Jun 2022 05:44:05 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6B2D3B02F; Wed, 29 Jun 2022 02:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hTOUDEg4blfwUlQNzGC/+sYc9DIP+OWNGDmymLRC7EI=; b=oTtVDKJbUIdpUWfW1bnc8xR6ec IQsR3eTeNU6Zbl+LYfRtyMQL3pokuL+xCLGbDuQAWiwQUTh19A4NTHOmvlJrzEfX2Mv9D2Ol7FiLC cW5q6tGh2WxS294PooM7CRGLaiBoOjtQnuMePLUBIHhz5cJUau2kWWDAXAXjZh/GbsYfWd2bzJ3tY lN4nk6aCAkF9p2QUzPJewP3Zg7X0ryCT0P+Am2CnTaZS/i1x142TSgFTE6FASGpsO2prQJzglA0fL 8y1JD/AIoevunjSjKb6edLa1ZY3lyuxIL7Pg6EPgpIc+LErA2oqtFB9w3wNiPGewhZcnUQWmmgmkC Iy1IjcDQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33088) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o6UEm-0002mh-RT; Wed, 29 Jun 2022 10:43:56 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1o6UEk-0005kp-FV; Wed, 29 Jun 2022 10:43:54 +0100 Date: Wed, 29 Jun 2022 10:43:54 +0100 From: "Russell King (Oracle)" To: Jianglei Nie Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v3] net: sfp: fix memory leak in sfp_probe() Message-ID: References: <20220629075550.2152003-1-niejianglei2021@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220629075550.2152003-1-niejianglei2021@163.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, 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 Wed, Jun 29, 2022 at 03:55:50PM +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 use devm_add_action_or_reset() instead of devm_add_action(). > > Signed-off-by: Jianglei Nie Thanks! Reviewed-by: Russell King (Oracle) -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!