nfsd xdr fixes
Subsystems (2)
The following are some small patches for bugs found while working on the xdr code.
--b.
PATCH 1/5 nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
From: "J. Bruce Fields" <[email protected]>
This was an omission from 8c18f2052e756e7d5dea712fc6e7ed70c00e8a39 "nfsd41: SUPPATTR_EXCLCREAT attribute".
--- fs/nfsd/nfs4xdr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfsd/nfs4xdr.c +2 -0
@@ -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 );
Signature · 1 line
1.7.9.5
PATCH 3/5 nfsd4: fix test_stateid error reply encoding
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
If the entire operation fails then there's nothing to encode.
--- fs/nfsd/nfs4xdr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfsd/nfs4xdr.c +3 -0
@@ -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);
Signature · 1 line
1.7.9.5
PATCH 5/5 nfsd4: make set of large acl return efbig, not resource
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
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).
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -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 )
Signature · 1 line
1.7.9.5
PATCH 2/5 nfsd4: leave reply buffer space for failed setattr
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
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.
--- fs/nfsd/nfsd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfsd.h +1 -1
@@ -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 */
Signature · 1 line
1.7.9.5
PATCH 4/5 nfsd4: session needs room for following op to error out
In reply to J. Bruce FieldsFrom: "J. Bruce Fields" <[email protected]>
--- fs/nfsd/nfs4proc.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/nfsd/nfs4proc.c +6 -0
@@ -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); }
Signature · 1 line
1.7.9.5
Re: [PATCH 1/5] nfsd4: buffer-length check for SUPPATTR_EXCLCREAT
In reply to J. Bruce FieldsQuoted 7 lines · J. Bruce Fields
From: "J. Bruce Fields" <[email protected]>
This was an omission from
8c18f2052e756e7d5dea712fc6e7ed70c00e8a39"nfsd41:SUPPATTR_EXCLCREATattribute".Cc Benny Halevy <[email protected]>
Ack.
Thanks for fixing!
Benny
Quoted 18 lines
Signed-off-by J. Bruce Fields <[email protected]>--- fs/nfsd/nfs4xdr.c | 2 ++ 1 file changed, 2 insertions(+)fs/nfsd/nfs4xdr.c +2
-0@@ -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 );