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 C3E973B42EF; Tue, 21 Jul 2026 20:40:03 +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=1784666404; cv=none; b=DytjartfHoI7d7aBm/N9J7EdtNDfjEIWONs2GbbBZkmYLH/hegT8yB0jMYg3lxNc/blUMxPi5KbJDq1tcn0gQiLicHOWfhWxSDIJ74pMfZu13kwEs77ixM3bxmPB+7MY+yRKQDyfPM41807zdQxevnpU1ojOC5TCx7Zp268Vb2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784666404; c=relaxed/simple; bh=N8g2d2Gx5YG+px5dvx4CuuwfV5toZjweiy3cFD+ZmZs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NHJvt4BmRW0FlkK+UzSEggnM9qPL9ePSVsgWx7Ej1AzTQPB8+XaXpku2Up8z6h+M9zvLJKDLd0lTRXX/lkvSGlSgL4ia4XQlzSEKN58SAV2PkJsvr//O5DZeldfueAiPp6S4sygoeNYezf+JX7TM6zgnahpqg6LbpjjmPgw1qKA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MZjstsGP; 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="MZjstsGP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B8F41F00A3A; Tue, 21 Jul 2026 20:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784666403; bh=mLgUYnHutukzQdocV3wqVj3Mrt2JBDTUVdnHWHna4iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MZjstsGPQKUpWe7CR0Wh+keNYKhEG2JQCnlvcL5vCU6xx1SQzVO/yxwasFB1Nrh4R iKZCPIHD7Iypf/8n9as3Z+1b9POcowcW6UIA+U0RggZ3H+RaT+RpNHtqqcg4mtfnEn zvAZ0rXSU4XMNOHGl8bZ1X0L6Drse+rGbWSyDbX0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chuck Lever , Anna Schumaker , Sasha Levin Subject: [PATCH 6.6 0670/1266] xprtrdma: Check frwr_wp_create() during connect Date: Tue, 21 Jul 2026 17:18:27 +0200 Message-ID: <20260721152456.853784467@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chuck Lever [ Upstream commit 0f13fc7c7d2e0427517e63c739277a4cd338b0c5 ] frwr_wp_create() creates the singleton Memory Region used to encode padding for Write chunks whose payload length is not XDR-aligned. Its failure paths return a negative errno and leave ep->re_write_pad_mr set to NULL. rpcrdma_xprt_connect() currently ignores that return value. If frwr_wp_create() fails after the rest of the connection setup succeeds, xprt_rdma_connect_worker() treats the connection attempt as successful and sets XPRT_CONNECTED. A later NFS/RDMA read with a non-4-byte-aligned receive page length reaches rpcrdma_encode_write_list(), passes the NULL write-pad MR to encode_rdma_segment(), and dereferences it. This is locally triggerable on an NFS/RDMA client after a connect or reconnect hits a local MR allocation, DMA-map, MR-map, or post-send failure; a remote peer alone cannot force the local MR setup failure. Check the return value and fail the connect as -ENOTCONN, matching the adjacent setup failures. This keeps XPRT_CONNECTED clear and lets the normal reconnect path retry. Fixes: 21037b8c2258 ("xprtrdma: Provide a buffer to pad Write chunks of unaligned length") Signed-off-by: Chuck Lever Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- net/sunrpc/xprtrdma/verbs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index ad463196f8e95d..46e3db61f1b4e7 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -536,7 +536,17 @@ int rpcrdma_xprt_connect(struct rpcrdma_xprt *r_xprt) goto out; } rpcrdma_mrs_create(r_xprt); - frwr_wp_create(r_xprt); + + /* + * rpcrdma_encode_write_list() dereferences the write-pad + * MR with no NULL check, so fail the connect rather than + * publish a transport whose write-pad MR is NULL. + */ + rc = frwr_wp_create(r_xprt); + if (rc) { + rc = -ENOTCONN; + goto out; + } out: trace_xprtrdma_connect(r_xprt, rc); -- 2.53.0