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 09C91221F26; Sat, 12 Sep 2026 11:02:51 +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=1789210972; cv=none; b=H/5x+Sl2WYyL/n/dmF9PrqWDdVfs07O7ayjogmsHng+Mhun0E8fhz0eaysqIR5aL6xVwRK99NC+fSU7wzZ4Se22y0A91snKE4TS9rXFhJhLVK4pSUpG0M3ddSk3vntRvmOmUM2LM7YwGleV94pgtu9VoQopuiJvg6s+POEpQXbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789210972; c=relaxed/simple; bh=qiFsqIr3zNY99F5jJhB+PN779uRj7DeR0ZkES99S6O8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HNq088pUTReXmMTYv0J83Im+iZ2h9tN8Lj0q8ihxhXVfumJLv2qb21WM6Irf9flN/yyEB/Tl2ItfYtDhEolqKn8mi2ytTFt1xOrk1nO+N9gpbCfjGxEaTxs+7WHpfzXvf9tmVX03lifEd+T/tIV7op2/yOc7GpUruwMYCHCfwp4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0vDMMuHo; 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="0vDMMuHo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E0C21F00893; Sat, 12 Sep 2026 11:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789210970; bh=9LsJHQDiM1tk132kPwTmFvnzATaFELcLkw2yL7e1D+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0vDMMuHoAceTL0utGsqyeJjlDJ/1ts2iKLk22Yr7boSw54k3ZU1dDsyulGoq80Cyq I6p8yf4HdB/bdshqTm87juRc6qf3iH4sCyJzhMqgOckcn232oAEoGKazbUaLEz+DJ9 Wpy2QOh0a7cq/0q1j8rtopY7HmAEio0/jeEXArjs= 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.18 1134/1518] RDMA/cxgb4: Free debugfs on registration failure Date: Sat, 12 Sep 2026 08:55:03 +0200 Message-ID: <20260912065649.112621164@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@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.18-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 d03936d007b0f..0d023c361ef8e 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -934,6 +934,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)); @@ -958,7 +959,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