summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svc.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2017-02-24 13:25:24 -0500
committerJ. Bruce Fields <bfields@redhat.com>2017-02-24 17:03:34 -0500
commit5283b03ee5cd28d516646298bead09b238d92ddc (patch)
treec2d955f18bd4390a4e52347052a2b3a7be745def /net/sunrpc/svc.c
parent362142b25843fb059941aaa01b91501d5d8652cc (diff)
nfs/nfsd/sunrpc: enforce transport requirements for NFSv4
NFSv4 requires a transport "that is specified to avoid network congestion" (RFC 7530, section 3.1, paragraph 2). In practical terms, that means that you should not run NFSv4 over UDP. The server has never enforced that requirement, however. This patchset fixes this by adding a new flag to the svc_version that states that it has these transport requirements. With that, we can check that the transport has XPT_CONG_CTRL set before processing an RPC. If it doesn't we reject it with RPC_PROG_MISMATCH. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r--net/sunrpc/svc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 85bcdea67a3f..1fc3ff822168 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1169,6 +1169,21 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1169 !(versp = progp->pg_vers[vers])) 1169 !(versp = progp->pg_vers[vers]))
1170 goto err_bad_vers; 1170 goto err_bad_vers;
1171 1171
1172 /*
1173 * Some protocol versions (namely NFSv4) require some form of
1174 * congestion control. (See RFC 7530 section 3.1 paragraph 2)
1175 * In other words, UDP is not allowed. We mark those when setting
1176 * up the svc_xprt, and verify that here.
1177 *
1178 * The spec is not very clear about what error should be returned
1179 * when someone tries to access a server that is listening on UDP
1180 * for lower versions. RPC_PROG_MISMATCH seems to be the closest
1181 * fit.
1182 */
1183 if (versp->vs_need_cong_ctrl &&
1184 !test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags))
1185 goto err_bad_vers;
1186
1172 procp = versp->vs_proc + proc; 1187 procp = versp->vs_proc + proc;
1173 if (proc >= versp->vs_nproc || !procp->pc_func) 1188 if (proc >= versp->vs_nproc || !procp->pc_func)
1174 goto err_bad_proc; 1189 goto err_bad_proc;