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 B8C80372ECD; Tue, 21 Jul 2026 17:11:30 +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=1784653892; cv=none; b=bHI1Jlww5ttrHVTN8/kmWUL0+L9Jlz8eGgoN57liOtwNSYxskBCa9B9VDrRLx2vmgxY42NK9wZiE1lxCo7NJDY9j5xCtYqBpuhUKJYWg9Oy4YZzIr2fLGDTPTXh04Fqv9bB2S02br02rK+rikitDu+wL/eS3clj2EfLR6EOk+eU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784653892; c=relaxed/simple; bh=JN3QwMEWEMYGeE6xTGl2oEaxAuLrQFdcubmQyd/0n64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RjEWJyIPHY19an7swb7d0eM8w+Hf5zUTIUfPoE8J1/Dwvy4NaE5cmkzps8FFFRTrdFmUUQvmxCgISvVnWdDNt0R4HWJSIWxj8gfqkxXUAlcGfg6PKRSY1O/SdqW3hNIaQe6hJpuj77jAOhW2qJc91LlRTtVHv4Iv8XNce/gbR70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=r9pY4hz5; 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="r9pY4hz5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2961B1F00A3F; Tue, 21 Jul 2026 17:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784653890; bh=2wHkfkMJxwbpkLj8EFPtnXKNtPgQeaZue6P7IMGw3o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r9pY4hz5r3f4gaAh1icU/G7Nfz3/59q6sAgAi76opqO3IiHMzU37GM8fv+Gb6bCuG qxUif5qqI4xqTfdbGVZU9j0iRNeexKugYM5tAP3/rrUOzSea1pmjrXpueBetDttma9 uxvl5705PAFqmE6pmWHmpeNTd9Z7e5fv2KfeRZCk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chuck Lever , Michael Nemanov , Anna Schumaker , Sasha Levin Subject: [PATCH 7.1 1498/2077] SUNRPC: release lower rpc_clnt if killed waiting for XPRT_LOCKED Date: Tue, 21 Jul 2026 17:19:31 +0200 Message-ID: <20260721152628.120774172@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@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 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chuck Lever [ Upstream commit 29bacb096d43bd04062f6655e50ceeed27fe6d2f ] xs_tcp_tls_setup_socket() creates a temporary "lower" rpc_clnt with rpc_create() to drive the inner TLS handshake, then waits for XPRT_LOCKED on its xprt with TASK_KILLABLE so a stuck handshake can be aborted by signal. When the wait is interrupted, the function jumps to out_unlock without releasing lower_clnt. The success path and the out_close error path both call rpc_shutdown_client(lower_clnt); only the killed-wait path skips it, leaking the clnt and its underlying xprt. Call rpc_shutdown_client() on this path before joining out_unlock. xprt_release_write() is not needed here because XPRT_LOCKED was never acquired. Fixes: 26e8bfa30dac ("SUNRPC/TLS: Lock the lower_xprt during the tls handshake") Signed-off-by: Chuck Lever Tested-by: Michael Nemanov Reviewed-by: Michael Nemanov Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- net/sunrpc/xprtsock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 2e1fe601336151..3eccd4923e6c66 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2734,8 +2734,11 @@ static void xs_tcp_tls_setup_socket(struct work_struct *work) lower_xprt = rcu_dereference(lower_clnt->cl_xprt); rcu_read_unlock(); - if (wait_on_bit_lock(&lower_xprt->state, XPRT_LOCKED, TASK_KILLABLE)) + if (wait_on_bit_lock(&lower_xprt->state, XPRT_LOCKED, TASK_KILLABLE)) { + /* XPRT_LOCKED was never acquired. */ + rpc_shutdown_client(lower_clnt); goto out_unlock; + } status = xs_tls_handshake_sync(lower_xprt, &upper_xprt->xprtsec); if (status) { -- 2.53.0