From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E7D6C3ACF06; Wed, 4 Feb 2026 14:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216552; cv=none; b=b9q0IYWmKAYQqMoqSQw+u0F3yZESPT7f51Vq0wyo+Fo8000pX5zo4IFdfAM9rpLeO00qddt4YqEpxtjA6bKTZNQ+4L0AHOqkW87y4YT1KzffDyjVKCa2dVBiWggeAET7a0mh72g6h7Hy2MufGc/jT/jnTOdg+QhAfHfTREYKQXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216552; c=relaxed/simple; bh=MSPrK59DVy4F08f5YtLI9OWBq58MAq9XyASaaYqx9s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IHO3ghNqDCpY906jJljqk2tOf2l2mJgnDTjfFPNYQrhsyKl2hdMkW7akzA4gjeUBhPc2tRUT6CYU+UqGNq/8bFBnzNWvp49lVgt5fRdGCU2Ejx/NAk3poOo4mMNyLzwRFVMlyPOnU0f6nP9fcXj5EarYt3I1J/9exFI6zkugap0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iuRuY6mw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iuRuY6mw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25BB4C4CEF7; Wed, 4 Feb 2026 14:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770216551; bh=MSPrK59DVy4F08f5YtLI9OWBq58MAq9XyASaaYqx9s4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuRuY6mwbFWQ0NJeYP3PPkwcF/aRO/6xy0Dc653hhN3IoXp8NI+wFtpYpW3Hhqr8B QzYbtc2HkSEcrGjXbLknLrV4th7GrqiQze75A+nqLpzmCNDGCrIRNG5YtEHAP4+6VC o3++ivTWwVma6emsCZyyNLNyf29gKUG8PKyvBFPk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kery Qi , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 121/161] rocker: fix memory leak in rocker_world_port_post_fini() Date: Wed, 4 Feb 2026 15:39:44 +0100 Message-ID: <20260204143856.099999927@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143851.755002596@linuxfoundation.org> References: <20260204143851.755002596@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Kery Qi [ Upstream commit 8d7ba71e46216b8657a82ca2ec118bc93812a4d0 ] In rocker_world_port_pre_init(), rocker_port->wpriv is allocated with kzalloc(wops->port_priv_size, GFP_KERNEL). However, in rocker_world_port_post_fini(), the memory is only freed when wops->port_post_fini callback is set: if (!wops->port_post_fini) return; wops->port_post_fini(rocker_port); kfree(rocker_port->wpriv); Since rocker_ofdpa_ops does not implement port_post_fini callback (it is NULL), the wpriv memory allocated for each port is never freed when ports are removed. This leads to a memory leak of sizeof(struct ofdpa_port) bytes per port on every device removal. Fix this by always calling kfree(rocker_port->wpriv) regardless of whether the port_post_fini callback exists. Fixes: e420114eef4a ("rocker: introduce worlds infrastructure") Signed-off-by: Kery Qi Reviewed-by: Simon Horman Link: https://patch.msgid.link/20260123211030.2109-2-qikeyu2017@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/rocker/rocker_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index ec90f75289dbe..4073e3852adb5 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -1525,9 +1525,8 @@ static void rocker_world_port_post_fini(struct rocker_port *rocker_port) { struct rocker_world_ops *wops = rocker_port->rocker->wops; - if (!wops->port_post_fini) - return; - wops->port_post_fini(rocker_port); + if (wops->port_post_fini) + wops->port_post_fini(rocker_port); kfree(rocker_port->wpriv); } -- 2.51.0