diff options
author | J. Bruce Fields <bfields@redhat.com> | 2016-06-10 23:56:05 +0300 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2016-11-01 22:47:52 +0300 |
commit | e864c189e1d63f2f6a052e296f0da0616d88b625 (patch) | |
tree | 9b88ed7ea2af0d4bde7b58dabf8bcba748e345ba /fs/nfsd/nfsd.h | |
parent | 916d2d844afd09dc8cf144e0e9dc98daa9dfc34a (diff) | |
download | linux-e864c189e1d63f2f6a052e296f0da0616d88b625.tar.xz |
nfsd: catch errors in decode_fattr earlier
3c8e03166ae2 "NFSv4: do exact check about attribute specified" fixed
some handling of unsupported-attribute errors, but it also delayed
checking for unwriteable attributes till after we decode them. This
could lead to odd behavior in the case a client attemps to set an
attribute we don't know about followed by one we try to parse. In that
case the parser for the known attribute will attempt to parse the
unknown attribute. It should fail in some safe way, but the error might
at least be incorrect (probably bad_xdr instead of inval). So, it's
better to do that check at the start.
As far as I know this doesn't cause any problems with current clients
but it might be a minor issue e.g. if we encounter a future client that
supports a new attribute that we currently don't.
Cc: Yu Zhiguo <yuzg@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfsd.h')
-rw-r--r-- | fs/nfsd/nfsd.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index a72d4163273a..7155239b2908 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h @@ -379,7 +379,11 @@ static inline bool nfsd_attrs_supported(u32 minorversion, u32 *bmval) #define NFSD_WRITEONLY_ATTRS_WORD1 \ (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) -/* These are the only attrs allowed in CREATE/OPEN/SETATTR. */ +/* + * These are the only attrs allowed in CREATE/OPEN/SETATTR. Don't add + * a writeable attribute here without also adding code to parse it to + * nfsd4_decode_fattr(). + */ #define NFSD_WRITEABLE_ATTRS_WORD0 \ (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL) #define NFSD_WRITEABLE_ATTRS_WORD1 \ |