From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F5DCECAAD3 for ; Mon, 19 Sep 2022 21:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbiISVVX (ORCPT ); Mon, 19 Sep 2022 17:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbiISVVW (ORCPT ); Mon, 19 Sep 2022 17:21:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3922DEDE; Mon, 19 Sep 2022 14:21:21 -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 504EE61A4D; Mon, 19 Sep 2022 21:21:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 533B6C433D6; Mon, 19 Sep 2022 21:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663622480; bh=OBH0AVFBPynesU/eettqD20mm5t3sWvYKQ6W7wlnQ9M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eNRi0EMFRJU0I346wH0LMFVZhTxli+Nl13a0g+pyw5j0SGf+zldf7yKdOaPfHv32T gg9oii2w/9qgUteA+clLI8GYydFpiRPfOwBDT11EfUouvaH1odCR7EGweR5ezThYpO lKfHXBQwkzBHC4dYTHMc3JwVq4y/l2I1KO2CUOI5UI2YlO9K0RmNqYFWf+KeZimBP3 /xkFWz/NtJTIWzmz9gfx+WFamVGexQsK/5Upc8JsS6xDOmZQ+kinw4KKQrcbpN/K34 9/k5TcGxrAV0mBe2OjWrIIIzwEh/9fEovTMkz07C6ae+mUyDnqdKVsm54u7gq2Kdke D+VUZZKT9Ny5w== Date: Mon, 19 Sep 2022 14:21:19 -0700 From: Jakub Kicinski To: Jianglei Nie Cc: aelior@marvell.com, skalluru@marvell.com, manishc@marvell.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Message-ID: <20220919142119.5b473800@kernel.org> In-Reply-To: <20220907065128.55190-1-niejianglei2021@163.com> References: <20220907065128.55190-1-niejianglei2021@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 7 Sep 2022 14:51:28 +0800 Jianglei Nie wrote: > bnx2x_tpa_stop() allocates a memory chunk from new_data with > bnx2x_frag_alloc(). The new_data should be freed when gets some error. > But when "pad + len > fp->rx_buf_size" is true, bnx2x_tpa_stop() returns > without releasing the new_data, which will lead to a memory leak. > > We should free the new_data with bnx2x_frag_free() when "pad + len > > fp->rx_buf_size" is true. Please add a Fixes tag and repost.