diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2012-03-02 17:13:50 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-03-20 15:36:15 -0400 |
commit | ab4684d1560f8d77f6ce82bd3f1f82937070d397 (patch) | |
tree | 71da95fc7b956d6c69f9ecf5ef98a76b158c387f /fs/nfsd/xdr4.h | |
parent | 8f199b8262cb150d055d29ba31faf0128ace4714 (diff) |
NFSD: Fix nfs4_verifier memory alignment
Clean up due to code review.
The nfs4_verifier's data field is not guaranteed to be u32-aligned.
Casting an array of chars to a u32 * is considered generally
hazardous.
We can fix most of this by using a __be32 array to generate the
verifier's contents and then byte-copying it into the verifier field.
However, there is one spot where there is a backwards compatibility
constraint: the do_nfsd_create() call expects a verifier which is
32-bit aligned. Fix this spot by forcing the alignment of the create
verifier in the nfsd4_open args structure.
Also, sizeof(nfs4_verifer) is the size of the in-core verifier data
structure, but NFS4_VERIFIER_SIZE is the number of octets in an XDR'd
verifier. The two are not interchangeable, even if they happen to
have the same value.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/xdr4.h')
-rw-r--r-- | fs/nfsd/xdr4.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index b89781f1477a..1b3501598ab5 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
@@ -228,7 +228,8 @@ struct nfsd4_open { | |||
228 | u32 op_createmode; /* request */ | 228 | u32 op_createmode; /* request */ |
229 | u32 op_bmval[3]; /* request */ | 229 | u32 op_bmval[3]; /* request */ |
230 | struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */ | 230 | struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */ |
231 | nfs4_verifier verf; /* EXCLUSIVE4 */ | 231 | nfs4_verifier op_verf __attribute__((aligned(32))); |
232 | /* EXCLUSIVE4 */ | ||
232 | clientid_t op_clientid; /* request */ | 233 | clientid_t op_clientid; /* request */ |
233 | struct xdr_netobj op_owner; /* request */ | 234 | struct xdr_netobj op_owner; /* request */ |
234 | u32 op_seqid; /* request */ | 235 | u32 op_seqid; /* request */ |
@@ -247,7 +248,6 @@ struct nfsd4_open { | |||
247 | struct nfs4_acl *op_acl; | 248 | struct nfs4_acl *op_acl; |
248 | }; | 249 | }; |
249 | #define op_iattr iattr | 250 | #define op_iattr iattr |
250 | #define op_verf verf | ||
251 | 251 | ||
252 | struct nfsd4_open_confirm { | 252 | struct nfsd4_open_confirm { |
253 | stateid_t oc_req_stateid /* request */; | 253 | stateid_t oc_req_stateid /* request */; |