nfs41: ensure negotiated session values are reasonable
Subsystems (2)
PATCH 1/1 nfs41: ensure negotiated session values are reasonable
Signed-off-by Alexandros Batsakis <[email protected]>
--- fs/nfs/nfs4proc.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +17 -2
@@ -4832,6 +4832,21 @@ static int nfs4_verify_channel_attrs(struct nfs41_create_session_args *args,return ret; } +static int nfs4_check_sane_channel_attrs (struct nfs4_session *session) +{ +int ret =0 ; + + ret |= session->fc_attrs.max_rqst_sz <NFS_MIN_FILE_IO_SIZE + nfs41_maxwrite_overhead; + ret |= session->fc_attrs.max_resp_sz <NFS_MIN_FILE_IO_SIZE + nfs41_maxread_overhead; + ret |= session->fc_attrs.max_ops <NFS4_MAX_OPS ; + +if (ret) { +printk (KERN_WARNING "Session INVALID: negotiated channel values too small" ); + ret = -EINVAL ; + } +return ret; +} +static int _nfs4_proc_create_session (struct nfs_client *clp) {struct nfs4_session *session = clp->cl_session;
@@ -4855,8 +4870,8 @@ static int _nfs4_proc_create_session(struct nfs_client *clp) status =rpc_call_sync (session->clp->cl_rpcclient, &msg,0 );if (!status) -/* Verify the session's negotiated channel_attrs values */ - status =nfs4_verify_channel_attrs (&args, session); + status =nfs4_verify_channel_attrs (&args, session) | +nfs4_check_sane_channel_attrs (session);if (!status) {/* Increment the clientid slot sequence id */ clp->cl_seqid++;
Signature · 1 line
1.6.2.5