Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3630072iog; Mon, 27 Jun 2022 22:17:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tG0fLHaSydg+Jbhc4JKEJsAMA3Mtwd0gLq0FXRDt1m9uYWdAWHR4/QoRlPZZJqo347+DcE X-Received: by 2002:a17:907:608d:b0:722:ebcc:b108 with SMTP id ht13-20020a170907608d00b00722ebccb108mr15644947ejc.94.1656393469386; Mon, 27 Jun 2022 22:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656393469; cv=none; d=google.com; s=arc-20160816; b=E1y2V/P/mKwqYx8i20i+HUSyGy7jVy23APGjfHc9socP+kzUG12DfDWsg5vE7NH6Pp y0ppdg0AvRW06rkEDUwDCfgg1UVlNwbPGKK9oqxHCK/AmmnIuRGigH41eP62gobHsYg5 eB5QaX2GkQbql0FLHWRAZyZgRrbMwQSxZo5/Tz5ZTOoUyHz0tEK9RolonuknCNhd5mNK B8megsYSmmh7ZOJGJCbWrEm9u6U1ZprnL9yZP6ZYiOekDbOdKdzpCeBxSxhhLSSpegtl DLL7zqIEmBviiECLCv+1JV7xmf8StGNSPMvtlMMztX1Nz+QeWyQ+yOmuvZxtNCzsaupC DQ0Q== 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=GKWwrZIu6mBSZ8i5kiyAQfCfJ2VFaY2z8Y42FD3MLj4=; b=BAbeSu//SLMQbCuRL+MPG0GnPdJGar27X3goUx2uVjXcbqXMsc5UGq1QKNeFWsChSO zR9pCZDC/UH11pZR0zFMAAdOA1EzBfbHC37M/Ac7/9G1zSm+VV/jEvaGLsdWRCYg8NNZ lPXKOd5ZOQ4Znpdc2Ih6XD9k356Q2Qi+dPFU04w4wNz7JAVjWc9j/qiruqVhGy0P2sD5 Avka27afUVkl8UyNifoxWULOgpKA28MC4zSuagxjqh2YgkZddYURhWA5pkelUiXGdQVO Igf023ftu4h67i/ODWZbiiED8HblAQ59r2OXNL36DOedcABe7x8/WZTyh6ofiWUyYn2G qDSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hg/plIKh"; 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 mp7-20020a1709071b0700b00711d26bf606si13702404ejc.767.2022.06.27.22.17.20; Mon, 27 Jun 2022 22:17:49 -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="hg/plIKh"; 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 S244388AbiF1FLM (ORCPT + 99 others); Tue, 28 Jun 2022 01:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbiF1FLJ (ORCPT ); Tue, 28 Jun 2022 01:11:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AC09FCF; Mon, 27 Jun 2022 22:11:08 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5D08B61784; Tue, 28 Jun 2022 05:11:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 205F3C341C6; Tue, 28 Jun 2022 05:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656393067; bh=gRITldOs4wFjJJ/Yq+ASt8gLd+uLO3gYyD/lQOZHrqc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hg/plIKhrf8qrDSTcJYKhT1RGIr4RqDfcYcCSW3eMK10FeVlkwyDLCHfbgMiqB5Wk JwEfFYAqNZPov9K81/sAvff2wXm1RhWjJqa+qTglgwHESfNDkupNnOCaI6JgzxCzzs ujt4GgSegDKOxupcXcQVtmk09aI4OOXHGrluD5Xc5BIjjJwbBBNF9Vh/5G9tsYc8pW VJcUmpyr09GOSzm8ixltVD+kTm7i3E+6KfuP8S2nMTVPJkIpeSMI64hUEcYByaXTVH cimlXr7ypucRtrCfLcZFZCYlkffbUcXuxWH+9XxWotNFPWBaUfx6bvKa1IrKpGP2BG T/b3TtnqHGKQA== Date: Mon, 27 Jun 2022 22:11:05 -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 v2] net: sfp: fix memory leak in sfp_probe() Message-ID: <20220627221105.5a5feb7c@kernel.org> In-Reply-To: <20220624044941.1807118-1-niejianglei2021@163.com> References: <20220624044941.1807118-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.5 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 Fri, 24 Jun 2022 12:49:41 +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(). Please add a Fixes tag referencing the commit which added the bug. The subject for the next version should be start with [PATCH net v3].