From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D6E543CEF9; Tue, 21 Jul 2026 22:54:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674459; cv=none; b=W4FwVOiHqlnfzDBTbRqP0vwkWeF3R0ciD4OrBaTc393uLysUfuPpfTWy9ZMEaxSwSBo4m28QaOwZqLyIWKyjRYw7CiEAfN3Cxo779yD3AGnAhSEJRlt97ZFHJj8561SWsR8/GgqjAPkfWumbEovg971VzTv9z+abSOydztbd9mM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674459; c=relaxed/simple; bh=B/i+Rhc7ZR/4DYlHkVc1SdQTma6YYfY8dJFa7S0gcxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AFaw/lL6RV6D8/i4h8SwTfua/Ll3qPNO9N9iPFyCS2qNiQjlPcuwWW/7ss4FtghdCNprSnzhFLZSvmJ8vbDmZ9g4fkNE9hy88LfEmL2+TmsOdbsf15JFf/pExybDkVmvzPblNsQo2JRhQhEK8vSG5Cwv2CquCDPd7UGboFmBY6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eSPSoTtd; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eSPSoTtd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D27C1F000E9; Tue, 21 Jul 2026 22:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674458; bh=K7xkAsdq+/NJPw0oSrdOFvTwCEJ7nIeXgrQTCGjg/oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eSPSoTtd2hNqyNK25Y4E6zpMvEyOczRV9vG4dDuZAhUaeq0v7wyVol/3h1cfB3xQt F/NchRKPAPQRojJyR8KA3jtZUEBusSAl+8UNsY9iKT7W8TuGPZRxSk3UDnZ+2eeRTu QMrFdqc8mUqIY08/NnurHfCYk7MtmMhovb3w4aZc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdun Nihaal , Simon Horman , Jakub Kicinski Subject: [PATCH 5.10 542/699] bnx2x: fix potential memory leak in bnx2x_alloc_mem_bp() Date: Tue, 21 Jul 2026 17:25:01 +0200 Message-ID: <20260721152407.930278867@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdun Nihaal commit a986fde914d88af47eb78fd29c5d1af7952c3500 upstream. If the allocation of fp[i].tpa_info fails, the error path will not free the struct bnx2x_fastpath allocated earlier, as it is not linked to the bp structure yet. Fix that by linking it immediately after allocation. Cc: stable@vger.kernel.org Fixes: 15192a8cf8a8 ("bnx2x: Split the FP structure") Signed-off-by: Abdun Nihaal Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260620062402.89549-1-nihaal@cse.iitm.ac.in Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -4740,6 +4740,7 @@ int bnx2x_alloc_mem_bp(struct bnx2x *bp) fp = kcalloc(bp->fp_array_size, sizeof(*fp), GFP_KERNEL); if (!fp) goto alloc_err; + bp->fp = fp; for (i = 0; i < bp->fp_array_size; i++) { fp[i].tpa_info = kcalloc(ETH_MAX_AGGREGATION_QUEUES_E1H_E2, @@ -4748,8 +4749,6 @@ int bnx2x_alloc_mem_bp(struct bnx2x *bp) goto alloc_err; } - bp->fp = fp; - /* allocate sp objs */ bp->sp_objs = kcalloc(bp->fp_array_size, sizeof(struct bnx2x_sp_objs), GFP_KERNEL);