linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kinglong Mee <kinglongmee@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFSD: fix bad length checking for backchannel
Date: Fri, 3 Jan 2014 16:57:24 -0500	[thread overview]
Message-ID: <20140103215724.GC5164@fieldses.org> (raw)
In-Reply-To: <52B80C36.8020000@gmail.com>

On Mon, Dec 23, 2013 at 06:11:02PM +0800, Kinglong Mee wrote:
> the length for backchannel checking should be multiplied by sizeof(__be32).

Thanks, applying.

--b.

> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfsd/nfs4state.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 105d6fa..05f4db8 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1851,6 +1851,11 @@ static __be32 check_forechannel_attrs(struct nfsd4_channel_attrs *ca, struct nfs
>  	return nfs_ok;
>  }
>  
> +#define NFSD_CB_MAX_REQ_SZ	((NFS4_enc_cb_recall_sz + \
> +				 RPC_MAX_HEADER_WITH_AUTH) * sizeof(__be32))
> +#define NFSD_CB_MAX_RESP_SZ	((NFS4_dec_cb_recall_sz + \
> +				 RPC_MAX_REPHEADER_WITH_AUTH) * sizeof(__be32))
> +
>  static __be32 check_backchannel_attrs(struct nfsd4_channel_attrs *ca)
>  {
>  	ca->headerpadsz = 0;
> @@ -1861,9 +1866,9 @@ static __be32 check_backchannel_attrs(struct nfsd4_channel_attrs *ca)
>  	 * less than 1k.  Tighten up this estimate in the unlikely event
>  	 * it turns out to be a problem for some client:
>  	 */
> -	if (ca->maxreq_sz < NFS4_enc_cb_recall_sz + RPC_MAX_HEADER_WITH_AUTH)
> +	if (ca->maxreq_sz < NFSD_CB_MAX_REQ_SZ)
>  		return nfserr_toosmall;
> -	if (ca->maxresp_sz < NFS4_dec_cb_recall_sz + RPC_MAX_REPHEADER_WITH_AUTH)
> +	if (ca->maxresp_sz < NFSD_CB_MAX_RESP_SZ)
>  		return nfserr_toosmall;
>  	ca->maxresp_cached = 0;
>  	if (ca->maxops < 2)
> -- 
> 1.8.4.2

      reply	other threads:[~2014-01-03 21:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-23 10:11 [PATCH] NFSD: fix bad length checking for backchannel Kinglong Mee
2014-01-03 21:57 ` J. Bruce Fields [this message]

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=20140103215724.GC5164@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=kinglongmee@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).