xfs
[Top] [All Lists]

Re: [PATCH v13 47/51] nfs: Fix GETATTR bitmap verification

To: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Subject: Re: [PATCH v13 47/51] nfs: Fix GETATTR bitmap verification
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date: Tue, 3 Nov 2015 11:30:19 -0500
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, "Theodore Ts'o" <tytso@xxxxxxx>, Andreas Dilger <adilger.kernel@xxxxxxxxx>, "J. Bruce Fields" <bfields@xxxxxxxxxxxx>, Jeff Layton <jlayton@xxxxxxxxxxxxxxx>, Anna Schumaker <anna.schumaker@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, linux-ext4@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Linux FS-devel Mailing List <linux-fsdevel@xxxxxxxxxxxxxxx>, Linux NFS Mailing List <linux-nfs@xxxxxxxxxxxxxxx>, linux-cifs@xxxxxxxxxxxxxxx, Linux API Mailing List <linux-api@xxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=primarydata_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=U64E7QOXNzcwkzcKfmchTrKOXLmtgJiwpT/4AGbI4ZA=; b=AKR9hJTqyi+092ibQAOvuhojo81edO6wT3MLMWU+u/hzCkxhVm6EIpwgXBW/usz5E6 gpXwPFoxx7B4mvbPezU1p9bGOuFRjkmZbBeOuL2pBAM3v0BtJRRtbpHNcwKbvpwRdqIP 2eM723vnlyfedWG9oCyrfN218QwPmPkpOdOr28KMpI/tChQdISUSdche9q1i8gRTU91Z tpRrAY9AvP86KKxdIyFLyBlIDmpu2MY+QpuShNVM4gDYcP8CGEXoeYfLi8+jlMhmJpQ5 x+zge8ayaB4pCvSD+53YWPg3bNkYxBJsfVVRBqpS/G3x0mB4nVnqFVOvAAOtwHEhYrn/ LyJg==
In-reply-to: <1446563847-14005-48-git-send-email-agruenba@xxxxxxxxxx>
References: <1446563847-14005-1-git-send-email-agruenba@xxxxxxxxxx> <1446563847-14005-48-git-send-email-agruenba@xxxxxxxxxx>
On Tue, Nov 3, 2015 at 10:17 AM, Andreas Gruenbacher
<agruenba@xxxxxxxxxx> wrote:
> When decoding GETATTR replies, the client checks the attribute bitmap
> for which attributes the server has sent.  It misses bits at the word
> boundaries, though; fix that.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
> ---
>  fs/nfs/nfs4xdr.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
> index 788adf3..6f6d921 100644
> --- a/fs/nfs/nfs4xdr.c
> +++ b/fs/nfs/nfs4xdr.c
> @@ -4375,6 +4375,11 @@ static int decode_statfs(struct xdr_stream *xdr, 
> struct nfs_fsstat *fsstat)
>                 goto xdr_error;
>         if ((status = decode_attr_files_total(xdr, bitmap, &fsstat->tfiles)) 
> != 0)
>                 goto xdr_error;
> +
> +       status = -EIO;
> +       if (unlikely(bitmap[0]))
> +               goto xdr_error;
> +
>         if ((status = decode_attr_space_avail(xdr, bitmap, &fsstat->abytes)) 
> != 0)
>                 goto xdr_error;
>         if ((status = decode_attr_space_free(xdr, bitmap, &fsstat->fbytes)) 
> != 0)
> @@ -4574,6 +4579,10 @@ static int decode_getfattr_attrs(struct xdr_stream 
> *xdr, uint32_t *bitmap,
>                 goto xdr_error;
>         fattr->valid |= status;
>
> +       status = -EIO;
> +       if (unlikely(bitmap[0]))
> +               goto xdr_error;
> +
>         status = decode_attr_mode(xdr, bitmap, &fmode);
>         if (status < 0)
>                 goto xdr_error;
> @@ -4627,6 +4636,10 @@ static int decode_getfattr_attrs(struct xdr_stream 
> *xdr, uint32_t *bitmap,
>                 goto xdr_error;
>         fattr->valid |= status;
>
> +       status = -EIO;
> +       if (unlikely(bitmap[1]))
> +               goto xdr_error;
> +
>         status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold);
>         if (status < 0)
>                 goto xdr_error;
> @@ -4789,12 +4802,22 @@ static int decode_fsinfo(struct xdr_stream *xdr, 
> struct nfs_fsinfo *fsinfo)
>         if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0)
>                 goto xdr_error;
>         fsinfo->wtpref = fsinfo->wtmax;
> +
> +       status = -EIO;
> +       if (unlikely(bitmap[0]))
> +               goto xdr_error;
> +
>         status = decode_attr_time_delta(xdr, bitmap, &fsinfo->time_delta);
>         if (status != 0)
>                 goto xdr_error;
>         status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype);
>         if (status != 0)
>                 goto xdr_error;
> +
> +       status = -EIO;
> +       if (unlikely(bitmap[1]))
> +               goto xdr_error;
> +
>         status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize);
>         if (status)
>                 goto xdr_error;
> --
> 2.5.0

This patch can and should be merged separately from this patchset.
Please submit it through the usual channels.

Trond

<Prev in Thread] Current Thread [Next in Thread>