Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5585580rwb; Tue, 22 Nov 2022 01:59:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aRSE9I3J/P30GXzr2EWvuR57nTyRxlvzuNyzU5b1ORYT04FMBBhDZUIrHzx45TBYrVRW8 X-Received: by 2002:aa7:d4cf:0:b0:461:a9ce:5408 with SMTP id t15-20020aa7d4cf000000b00461a9ce5408mr9537771edr.201.1669111180024; Tue, 22 Nov 2022 01:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669111180; cv=none; d=google.com; s=arc-20160816; b=RBSYvgL46LBGr6kOB9h2iFzlgyl6CR62jA+Ewt3MTgo2/HiiDxkOiSqaRqOsGBsrzd zrcDmEde1/f2yeL/vtg9/S0O48cnaZNB0WYJey1oXAYLvlkFozGiHbUyuonyWQ4Hw4dg l2uUlF+u/QlN3OQjpwzDGEArX2z/Yk9q4RTHxvwDGho3FSbBi3AVw+gIrnDUiaNPYB+B 2dG2mO63z8ZxzXc23gOk2AeGg9+iz4GnBcl5HMyXfTkJdUDMMd00xPM2HZnJHoKIvja2 4mj/H0/V+sMXnbuhJca1dPCoe3lpyi+E5utuVpiexPbpn7mb2Ps5dYHwNf1axjJAy2+L 2ZPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xrqpFS3LzFGELvs4m5UeNmvZV6Wy+ijtEH3DAl5GoaM=; b=HzlixX8ta1j4W+B8gZw9X+8164y0twIbQ7CiTJg7VPHVUfcQgZ9gQ8oej+dsy6T0Xm sa4WXHPP6GClUrurj1VobFCyA3cwSnUyMrllYH7d6NujsAkMOAfkK5OcgvShi61kCLUy aNZub/+DXTgS1XYXNye3bNERcpVUFhli/CHXcwV0tcBHr1m3BXDciG8vTdFFtl4CoWO7 6lpner1FptqLdVwD3Wd525G+hEvG1+V3QkTwkby/H2dWXHlRL6wYNESDVH30OQmFGY/S /Kx2WekK+BVkSrwP9jre2+1rvRJ5eEC3mT260pwvDZ85AOxfM0bTj2MkZhSoPn1Zl/0U 3nmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EjRz0hp0; 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 ga22-20020a1709070c1600b0073d7111c8e7si12634412ejc.710.2022.11.22.01.59.17; Tue, 22 Nov 2022 01:59:40 -0800 (PST) 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=EjRz0hp0; 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 S233393AbiKVJrW (ORCPT + 91 others); Tue, 22 Nov 2022 04:47:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbiKVJrO (ORCPT ); Tue, 22 Nov 2022 04:47:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B258414007; Tue, 22 Nov 2022 01:47:13 -0800 (PST) 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 4F049615F8; Tue, 22 Nov 2022 09:47:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E5DEC433C1; Tue, 22 Nov 2022 09:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669110432; bh=UL5MzjRuYkiwDfixp0yElsuBzd8ef1l5k+fEAa+oJwM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EjRz0hp02xXIJwqJ0Kt2F7rWj+ZUVG4GmRJ8wdWkExkqrjSwOl84CUYYRumgzuXMO WVYtwQaLxsSfJNClEbWgoGlkRzWFpvJ6vfWWQ6wBRXvuAyrITOJ4xWnFHLZc45jGgq XKlE0lHiV+0KCCgb+JFR42CYU1DJpDpTy2AIMUTViIAzZ9Vah/yNewiqzLdiVovigZ w2IKdAaKwvKm2TUfxNCyh8cAEur7ZweaDeVYIOqzgOQDP7qhxb7BkGG9g0eDv6jiy+ L3oB8M3t8XxHTb83A0+ZHzfEU5ZflgXOvNk89DT6rYOmf+rLGzlu3ax0VTS7ofstiM 4X1co1K+vXtAQ== Date: Tue, 22 Nov 2022 11:47:09 +0200 From: Leon Romanovsky To: Paolo Abeni Cc: Zhang Changzhong , Edward Cree , "David S. Miller" , Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] sfc: fix potential memleak in __ef100_hard_start_xmit() Message-ID: References: <1668671409-10909-1-git-send-email-zhangchangzhong@huawei.com> <0a568e890497f4066128b1ce957904e0c5540c16.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a568e890497f4066128b1ce957904e0c5540c16.camel@redhat.com> X-Spam-Status: No, score=-7.1 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 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 Tue, Nov 22, 2022 at 09:28:42AM +0100, Paolo Abeni wrote: > Hello, > > On Fri, 2022-11-18 at 19:11 +0200, Leon Romanovsky wrote: > > On Fri, Nov 18, 2022 at 09:15:43AM +0000, Martin Habets wrote: > > > On Thu, Nov 17, 2022 at 03:05:27PM +0200, Leon Romanovsky wrote: > > > > Please take a look __ef100_enqueue_skb() and see if it frees SKB on > > > > error or not. If not, please fix it. > > > > > > That function looks ok to me, but I appreciate the extra eyes on it. > > > > __ef100_enqueue_skb() has the following check in error path: > > > > 498 err: > > 499 efx_enqueue_unwind(tx_queue, old_insert_count); > > 500 if (!IS_ERR_OR_NULL(skb)) > > 501 dev_kfree_skb_any(skb); > > 502 > > > > The issue is that skb is never error or null here and this "if" is > > actually always true and can be deleted. > > I think that such additional change could be suite for a different net- > next patch, while this -net patch could land as is, @Leon: do you > agree? > Sure, thanks, Reviewed-by: Leon Romanovsky