Skip to content

Commit

Permalink
NFSD: Replace READ* macros that decode the fattr4 umask attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Chuck Lever committed Nov 30, 2020
1 parent dabe918 commit 66f0476
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
{
unsigned int starting_pos;
u32 attrlist4_count;
u32 dummy32;

DECODE_HEAD;
iattr->ia_valid = 0;
Expand Down Expand Up @@ -474,13 +473,16 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
return status;
}
if (bmval[2] & FATTR4_WORD2_MODE_UMASK) {
u32 mode, mask;

if (!umask)
goto xdr_error;
READ_BUF(8);
dummy32 = be32_to_cpup(p++);
iattr->ia_mode = dummy32 & (S_IFMT | S_IALLUGO);
dummy32 = be32_to_cpup(p++);
*umask = dummy32 & S_IRWXUGO;
return nfserr_bad_xdr;
if (xdr_stream_decode_u32(argp->xdr, &mode) < 0)
return nfserr_bad_xdr;
iattr->ia_mode = mode & (S_IFMT | S_IALLUGO);
if (xdr_stream_decode_u32(argp->xdr, &mask) < 0)
return nfserr_bad_xdr;
*umask = mask & S_IRWXUGO;
iattr->ia_valid |= ATTR_MODE;
}

Expand Down

0 comments on commit 66f0476

Please sign in to comment.