Signed-off-by: Alexandros Batsakis <batsakis@xxxxxxxxxx> --- fs/nfs/nfs4proc.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 198d51d..a4b7d69 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -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++; -- 1.6.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html