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 2F8BD2882DE; Sat, 12 Sep 2026 16:44:34 +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=1789231476; cv=none; b=Lgztg4hrNxnRb99sdVpjSCGGiFARu/HdpqHBKoUrV9OtPyMpd8vPyRVHkGITDbgQU3HpmScs4rH49QWc1z4bXVfo9HuDqrRja6UPqY1prUB0O7Ftk+LGiVa1CA1CxDQhKPc285tg0ECQhqpfalhjNHf25TeDgiFeaxvewdKxL6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789231476; c=relaxed/simple; bh=I6ey8tSfzW3Is8CZ0Y7XVMU6GoknV1exRaVyipB/PmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O9/9X0Y8UC2WEL7fmLbq5pcky+z52O3W396UnyLv3hZIpJtipq61GNkiG2NtOEiEM4bQmBovynzIBNsgTNBlGoF59coU4kD4EyX+k7NGME/vCuYXbWB88NG8+90PuRYaprOEzK+LHdeNzblyrMz+x0sMWHncRZollAvIuZehkm4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=q9S2C8IE; 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="q9S2C8IE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 021B11F000FF; Sat, 12 Sep 2026 16:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789231474; bh=lq7h1ZIeYn/4210ffj1Nc21FqGNjqaWWOZ/JtJnKM1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q9S2C8IEzLBhhkBDkNC469Pdqyb3sDwRerX4+IBvvqrWrcPUGNDUDH9IunSK3fKTx EmPvE81sRZBIIqaqFL9ULIH/hovx68HXCA0UJ+CfhEPoh535XU9ccWt+QkVMN1gdo9 ClnBFq+kwLIXaUb8c7kKQRLQ21gMUcXS+cPKnhvw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fan Wu , Jason Gunthorpe , Sasha Levin Subject: [PATCH 6.1 0969/1191] RDMA/cxgb4: Free debugfs on registration failure Date: Sat, 12 Sep 2026 09:01:37 +0200 Message-ID: <20260912065609.978651783@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@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 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fan Wu [ Upstream commit fe5c16bb6252dea6025b748257ddc3b2665495b0 ] c4iw_alloc() creates the per-device debugfs tree (dev->debugfs_root via setup_debugfs()), but it is removed only in c4iw_remove(), not in c4iw_dealloc(). When RDMA device registration fails, the registration worker's err_dealloc_ctx path calls c4iw_dealloc() directly, bypassing c4iw_remove(), so the debugfs dentries leak and outlive the freed c4iw_dev. Move debugfs_remove_recursive() into c4iw_dealloc() so every path that frees ctx->dev also removes its debugfs tree. Fixes: 49ea0c036ede ("RDMA/iw_cxgb4: cleanup device debugfs entries on ULD remove") Link: https://patch.msgid.link/r/20260806130128.465460-2-fanwu01@zju.edu.cn Assisted-by: Codex:gpt-5.6 Signed-off-by: Fan Wu Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/cxgb4/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index ac86a77c712e9..d5101cabbd4b6 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -935,6 +935,7 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) void c4iw_dealloc(struct uld_ctx *ctx) { + debugfs_remove_recursive(ctx->dev->debugfs_root); c4iw_rdev_close(&ctx->dev->rdev); WARN_ON(!xa_empty(&ctx->dev->cqs)); WARN_ON(!xa_empty(&ctx->dev->qps)); @@ -959,7 +960,6 @@ static void c4iw_remove(struct uld_ctx *ctx) if (!ctx->dev) return; - debugfs_remove_recursive(ctx->dev->debugfs_root); c4iw_unregister_device(ctx->dev); c4iw_dealloc(ctx); } -- 2.53.0