linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes
@ 2017-05-09 20:24 Trond Myklebust
  2017-05-09 20:56 ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2017-05-09 20:24 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Anna Schumaker, linux-nfs

If an NFSv4 client asks us for the supattr_exclcreat, then we must
not return attributes that are unsupported by this minor version.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Fixes: 75976de6556f ("NFSD: Return word2 bitmask if setting security..,")
---
 fs/nfsd/nfs4xdr.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 33017d652b1d..187498db0aa9 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2831,9 +2831,14 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
 	}
 #endif /* CONFIG_NFSD_PNFS */
 	if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
-		status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0,
-						  NFSD_SUPPATTR_EXCLCREAT_WORD1,
-						  NFSD_SUPPATTR_EXCLCREAT_WORD2);
+		u32 supp[3];
+
+		memcpy(supp, nfsd_suppattrs[minorversion], sizeof(supp));
+		supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0;
+		supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1;
+		supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2;
+
+		status = nfsd4_encode_bitmap(xdr, supp[0], supp[1], supp[2]);
 		if (status)
 			goto out;
 	}
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes
  2017-05-09 20:24 [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes Trond Myklebust
@ 2017-05-09 20:56 ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2017-05-09 20:56 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Anna Schumaker, linux-nfs

On Tue, May 09, 2017 at 04:24:59PM -0400, Trond Myklebust wrote:
> If an NFSv4 client asks us for the supattr_exclcreat, then we must
> not return attributes that are unsupported by this minor version.

Thanks!  Applying with a stable cc.

--b.

> 
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> Fixes: 75976de6556f ("NFSD: Return word2 bitmask if setting security..,")
> ---
>  fs/nfsd/nfs4xdr.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 33017d652b1d..187498db0aa9 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -2831,9 +2831,14 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
>  	}
>  #endif /* CONFIG_NFSD_PNFS */
>  	if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
> -		status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0,
> -						  NFSD_SUPPATTR_EXCLCREAT_WORD1,
> -						  NFSD_SUPPATTR_EXCLCREAT_WORD2);
> +		u32 supp[3];
> +
> +		memcpy(supp, nfsd_suppattrs[minorversion], sizeof(supp));
> +		supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0;
> +		supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1;
> +		supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2;
> +
> +		status = nfsd4_encode_bitmap(xdr, supp[0], supp[1], supp[2]);
>  		if (status)
>  			goto out;
>  	}
> -- 
> 2.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes
  2017-05-23 20:38   ` Patch "nfsd: Fix up the "supattr_exclcreat" attributes" has been added to the 4.4-stable tree J. Bruce Fields
@ 2017-05-23 21:44     ` J. Bruce Fields
  2017-06-12  7:40       ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2017-05-23 21:44 UTC (permalink / raw)
  To: Greg KH; +Cc: trond.myklebust, stable, stable-commits, linux-nfs

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit b26b78cb726007533d81fdf90a62e915002ef5c8 upstream

If an NFSv4 client asks us for the supattr_exclcreat, then we must
not return attributes that are unsupported by this minor version.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Fixes: 75976de6556f ("NFSD: Return word2 bitmask if setting security..,")
[bfields: use old functions instead of new array in stable backport]
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4xdr.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

On Tue, May 23, 2017 at 04:38:24PM -0400, J. Bruce Fields wrote:
> The issue is
> 
> 	916d2d844afd "nfsd: clean up supported attribute handling"
> 	dcd208697707 "nfsd: fix supported attributes for acl & labels"
> 
> which replaced 3 numbered constants by an array, and went in between 4.8
> and 4.10.
> 
> But for the purposes of older stable branches, best is probably just to
> use the old constants.  I'll send an updated patch.

Here it is.  This should do for 4.9 and older stable branches.

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 12935209deca..37d30e5caf46 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2753,9 +2753,16 @@ out_acl:
 	}
 #endif /* CONFIG_NFSD_PNFS */
 	if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
-		status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0,
-						  NFSD_SUPPATTR_EXCLCREAT_WORD1,
-						  NFSD_SUPPATTR_EXCLCREAT_WORD2);
+		u32 supp[3];
+
+		supp[0] = nfsd_suppattrs0(minorversion);
+		supp[1] = nfsd_suppattrs1(minorversion);
+		supp[2] = nfsd_suppattrs2(minorversion);
+		supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0;
+		supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1;
+		supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2;
+
+		status = nfsd4_encode_bitmap(xdr, supp[0], supp[1], supp[2]);
 		if (status)
 			goto out;
 	}
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes
  2017-05-23 21:44     ` [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes J. Bruce Fields
@ 2017-06-12  7:40       ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-06-12  7:40 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: trond.myklebust, stable, stable-commits, linux-nfs

On Tue, May 23, 2017 at 05:44:50PM -0400, J. Bruce Fields wrote:
> From: Trond Myklebust <trond.myklebust@primarydata.com>
> 
> commit b26b78cb726007533d81fdf90a62e915002ef5c8 upstream
> 
> If an NFSv4 client asks us for the supattr_exclcreat, then we must
> not return attributes that are unsupported by this minor version.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> Fixes: 75976de6556f ("NFSD: Return word2 bitmask if setting security..,")
> [bfields: use old functions instead of new array in stable backport]
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfsd/nfs4xdr.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> On Tue, May 23, 2017 at 04:38:24PM -0400, J. Bruce Fields wrote:
> > The issue is
> > 
> > 	916d2d844afd "nfsd: clean up supported attribute handling"
> > 	dcd208697707 "nfsd: fix supported attributes for acl & labels"
> > 
> > which replaced 3 numbered constants by an array, and went in between 4.8
> > and 4.10.
> > 
> > But for the purposes of older stable branches, best is probably just to
> > use the old constants.  I'll send an updated patch.
> 
> Here it is.  This should do for 4.9 and older stable branches.

Thanks, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-12  7:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-09 20:24 [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes Trond Myklebust
2017-05-09 20:56 ` J. Bruce Fields
     [not found] <14955646521694@kroah.com>
     [not found] ` <20170523192339.GA30111@kroah.com>
2017-05-23 20:38   ` Patch "nfsd: Fix up the "supattr_exclcreat" attributes" has been added to the 4.4-stable tree J. Bruce Fields
2017-05-23 21:44     ` [PATCH] nfsd: Fix up the "supattr_exclcreat" attributes J. Bruce Fields
2017-06-12  7:40       ` Greg KH

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).