From: Chuck Lever <cel@kernel.org>
To: Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH v1] NFSv4.1: reject a minor version 0 CB_COMPOUND on the backchannel
Date: Fri, 25 Sep 2026 11:13:19 -0400 [thread overview]
Message-ID: <20260925151319.528740-1-cel@kernel.org> (raw)
nfs4_callback_compound() selects the minor version 0 path from the
CB_COMPOUND header alone. A malicious or broken NFS server can send
a minor version 0 CB_COMPOUND over a session backchannel, where
rq_xprt is NULL. If the NFS client also holds a minor version 0
client ID in the same network namespace, the cb_ident lookup
succeeds and svc_xprt_set_valid() dereferences the NULL rq_xprt.
RFC 8881 Section 19.2.3 requires a CB_COMPOUND to carry the minor
version of the COMPOUND that created the session. Return
NFS4ERR_MINOR_VERS_MISMATCH for a minor version 0 CB_COMPOUND that
arrives on a backchannel.
Fixes: eccbbc7c00a5 ("nfsd: don't use sv_nrthreads in connection limiting calculations.")
Signed-off-by: Chuck Lever <cel@kernel.org>
---
fs/nfs/callback_xdr.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 88e1af0fda01..378eacb5b6a9 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -951,7 +951,13 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp)
if (status == htonl(NFS4ERR_RESOURCE))
return rpc_garbage_args;
- if (hdr_arg.minorversion == 0) {
+ if (hdr_arg.minorversion == 0 && svc_is_backchannel(rqstp)) {
+ /* RFC 8881 Section 19.2.3: a backchannel carries only the
+ * minor version that created its session.
+ */
+ pr_warn_ratelimited("NFS: NFSv4 backchannel callback with minor version 0\n");
+ status = htonl(NFS4ERR_MINOR_VERS_MISMATCH);
+ } else if (hdr_arg.minorversion == 0) {
cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
if (!cps.clp) {
trace_nfs_cb_no_clp(rqstp->rq_xid, hdr_arg.cb_ident);
--
2.54.0
reply other threads:[~2026-09-25 15:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260925151319.528740-1-cel@kernel.org \
--to=cel@kernel.org \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.