* nfsd xdr fixes
@ 2014-02-24 22:08 J. Bruce Fields
2014-02-24 22:08 ` [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT J. Bruce Fields
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-02-24 22:08 UTC (permalink / raw)
To: linux-nfs
The following are some small patches for bugs found while working on the
xdr code.
--b.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
2014-02-24 22:08 nfsd xdr fixes J. Bruce Fields
@ 2014-02-24 22:08 ` J. Bruce Fields
2014-02-25 18:37 ` Benny Halevy
2014-02-24 22:08 ` [PATCH 2/5] nfsd4: leave reply buffer space for failed setattr J. Bruce Fields
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: J. Bruce Fields @ 2014-02-24 22:08 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields, stable, Benny Halevy
From: "J. Bruce Fields" <bfields@redhat.com>
This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39
"nfsd41: SUPPATTR_EXCLCREAT attribute".
Cc: stable@vger.kernel.org
Cc: Benny Halevy <bhalevy@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4xdr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 63f2395..668bfe1 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2483,6 +2483,8 @@ out_acl:
goto out;
}
if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
+ if ((buflen -= 16) < 0)
+ goto out_resource;
WRITE32(3);
WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0);
WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] nfsd4: leave reply buffer space for failed setattr
2014-02-24 22:08 nfsd xdr fixes J. Bruce Fields
2014-02-24 22:08 ` [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT J. Bruce Fields
@ 2014-02-24 22:08 ` J. Bruce Fields
2014-02-24 22:08 ` [PATCH 3/5] nfsd4: fix test_stateid error reply encoding J. Bruce Fields
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-02-24 22:08 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields, stable
From: "J. Bruce Fields" <bfields@redhat.com>
This fixes an ommission from 18032ca062e621e15683cb61c066ef3dc5414a7b
"NFSD: Server implementation of MAC Labeling", which increased the size
of the setattr error reply without increasing COMPOUND_ERR_SLACK_SPACE.
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfsd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 30f34ab..479eb68 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -282,7 +282,7 @@ void nfsd_lockd_shutdown(void);
* reason.
*/
#define COMPOUND_SLACK_SPACE 140 /* OP_GETFH */
-#define COMPOUND_ERR_SLACK_SPACE 12 /* OP_SETATTR */
+#define COMPOUND_ERR_SLACK_SPACE 16 /* OP_SETATTR */
#define NFSD_LAUNDROMAT_MINTIMEOUT 1 /* seconds */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] nfsd4: fix test_stateid error reply encoding
2014-02-24 22:08 nfsd xdr fixes J. Bruce Fields
2014-02-24 22:08 ` [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT J. Bruce Fields
2014-02-24 22:08 ` [PATCH 2/5] nfsd4: leave reply buffer space for failed setattr J. Bruce Fields
@ 2014-02-24 22:08 ` J. Bruce Fields
2014-02-24 22:08 ` [PATCH 4/5] nfsd4: session needs room for following op to error out J. Bruce Fields
2014-02-24 22:08 ` [PATCH 5/5] nfsd4: make set of large acl return efbig, not resource J. Bruce Fields
4 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-02-24 22:08 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields, stable
From: "J. Bruce Fields" <bfields@redhat.com>
If the entire operation fails then there's nothing to encode.
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4xdr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 668bfe1..d214359 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3473,6 +3473,9 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr,
struct nfsd4_test_stateid_id *stateid, *next;
__be32 *p;
+ if (nfserr)
+ return nfserr;
+
RESERVE_SPACE(4 + (4 * test_stateid->ts_num_ids));
*p++ = htonl(test_stateid->ts_num_ids);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] nfsd4: session needs room for following op to error out
2014-02-24 22:08 nfsd xdr fixes J. Bruce Fields
` (2 preceding siblings ...)
2014-02-24 22:08 ` [PATCH 3/5] nfsd4: fix test_stateid error reply encoding J. Bruce Fields
@ 2014-02-24 22:08 ` J. Bruce Fields
2014-02-24 22:08 ` [PATCH 5/5] nfsd4: make set of large acl return efbig, not resource J. Bruce Fields
4 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-02-24 22:08 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields, stable
From: "J. Bruce Fields" <bfields@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4proc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 82189b2..b9048e5 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1359,6 +1359,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
/* If op is non-idempotent */
if (opdesc->op_flags & OP_MODIFIES_SOMETHING) {
plen = opdesc->op_rsize_bop(rqstp, op);
+ /*
+ * If there's still another operation, make sure
+ * we'll have space to at least encode an error:
+ */
+ if (resp->opcnt < args->opcnt)
+ plen += COMPOUND_ERR_SLACK_SPACE;
op->status = nfsd4_check_resp_size(resp, plen);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] nfsd4: make set of large acl return efbig, not resource
2014-02-24 22:08 nfsd xdr fixes J. Bruce Fields
` (3 preceding siblings ...)
2014-02-24 22:08 ` [PATCH 4/5] nfsd4: session needs room for following op to error out J. Bruce Fields
@ 2014-02-24 22:08 ` J. Bruce Fields
4 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-02-24 22:08 UTC (permalink / raw)
To: linux-nfs; +Cc: J. Bruce Fields, stable
From: "J. Bruce Fields" <bfields@redhat.com>
If a client attempts to set an excessively large ACL, return
NFS4ERR_FBIG instead of NFS4ERR_RESOURCE. I'm not sure FBIG is correct,
but I'm positive RESOURCE is wrong (it isn't even a well-defined error
any more for NFS versions since 4.1).
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
fs/nfsd/nfs4xdr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d214359..aa04a6a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -294,7 +294,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
READ32(nace);
if (nace > NFS4_ACL_MAX)
- return nfserr_resource;
+ return nfserr_fbig;
*acl = nfs4_acl_new(nace);
if (*acl == NULL)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
2014-02-24 22:08 ` [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT J. Bruce Fields
@ 2014-02-25 18:37 ` Benny Halevy
0 siblings, 0 replies; 7+ messages in thread
From: Benny Halevy @ 2014-02-25 18:37 UTC (permalink / raw)
To: J. Bruce Fields, linux-nfs; +Cc: stable
On 02/24/2014 02:08 PM, J. Bruce Fields wrote:
> From: "J. Bruce Fields" <bfields@redhat.com>
>
> This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39
> "nfsd41: SUPPATTR_EXCLCREAT attribute".
>
> Cc: stable@vger.kernel.org
> Cc: Benny Halevy <bhalevy@primarydata.com>
Ack.
Thanks for fixing!
Benny
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
> fs/nfsd/nfs4xdr.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 63f2395..668bfe1 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -2483,6 +2483,8 @@ out_acl:
> goto out;
> }
> if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
> + if ((buflen -= 16) < 0)
> + goto out_resource;
> WRITE32(3);
> WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0);
> WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1);
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-02-25 18:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-24 22:08 nfsd xdr fixes J. Bruce Fields
2014-02-24 22:08 ` [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT J. Bruce Fields
2014-02-25 18:37 ` Benny Halevy
2014-02-24 22:08 ` [PATCH 2/5] nfsd4: leave reply buffer space for failed setattr J. Bruce Fields
2014-02-24 22:08 ` [PATCH 3/5] nfsd4: fix test_stateid error reply encoding J. Bruce Fields
2014-02-24 22:08 ` [PATCH 4/5] nfsd4: session needs room for following op to error out J. Bruce Fields
2014-02-24 22:08 ` [PATCH 5/5] nfsd4: make set of large acl return efbig, not resource J. Bruce Fields
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).