Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3071164rwb; Mon, 19 Sep 2022 14:36:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c6r/ey7qdMUFbRcI1Am0ELW4IqOi7IvcwN7llTY+ahZGeXqLMv8VWL4aConE+i+6x9jya X-Received: by 2002:a17:903:2582:b0:176:9ba8:3c9f with SMTP id jb2-20020a170903258200b001769ba83c9fmr1661733plb.87.1663623403145; Mon, 19 Sep 2022 14:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663623403; cv=none; d=google.com; s=arc-20160816; b=ZQCJVEs2S9DPsd8Ke744fw/ptv5mDfRgXvIpz5ffUUaxw0NdXdVcnaMUdVngDg0lKi 4zS/2BfsLi/2g31IrWndN/d7kczH9zaVmtoR7YftqSfuMlIhjdfeymUtysuGGFBv5IDe G9i5EZG87iiqS6h4bpdeJ+KyEmMkSQ4hoegU82GvZNk/M48lAF4T5vBG++i+U6aoBBQz F1ufIDwP1+ehMTwg0npGjHvXV+mB1UqAyt19AxX1DvCwo/gbU4cjbEbLWGS1lbuAqAIb NZLiPAcZRTNJVLuPjxzci9fpLlh3pGmBwwc9UigYysDsiGLIijrbDWkUjFHhUOv1P8pi yATg== 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=WeNc7EKEGrDoZIk3xeW0JeHHhHnYU4UGDGYbHYSK53g=; b=cTaKmi2tyQ94Yg5ckYwtrbQjrQIrA72lJKV/FMgRp/FWG6LvnYY86oDzryZALYvdFd bi5qS1ag97/ytvZN2Bj0CLYewIkEDRcPnc7uNsvpwZRdPvOjKu/7QNBH8/bAiJLae4PS HQfblOE/SuscVPtxlzyf8oyTSQj2T3lfYDpyUXN/pHkMTg11UuXKv8/izOmE3v1DtH/h VgOTzBFyU3CXddMvtA3jhM20uvwUcSLLfPrdMqTuuEhXmQXlAu+E9KxGg7euv4I3XGMp 5n+B11bFdn+XYxl9Uks1WF7aRbCxpZJJTgmI20WlxB8zlHd1fmSLM/aRn6pa8PeM1c1m 23Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eNRi0EMF; 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 q19-20020a056a00151300b00535fd435cf6si32131510pfu.208.2022.09.19.14.36.31; Mon, 19 Sep 2022 14:36:43 -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=eNRi0EMF; 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 S229792AbiISVVY (ORCPT + 99 others); Mon, 19 Sep 2022 17:21:24 -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 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 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.