diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-10-23 15:34:20 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-10-23 15:34:20 -0400 |
commit | 7ad07353003d6ff69fe0b987813bb77b4d5ac23d (patch) | |
tree | 580d0284b6946454d9136b3568e69eb3524be8ed /fs | |
parent | 4a201d6e3f4253f918555cc7c27c418f8ac1bb65 (diff) |
NFSv4: Fix up decode_attr_filehandle() to handle the case of empty fh pointer
decode_attr_filehandle still needs to skip the XDR-encoded filehandle if
someone passes a null pointer argument.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index ccfb1c92b262..a6b00e84bd1a 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -2883,12 +2883,8 @@ static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, stru __be32 *p; int len; - if (fh == NULL) { - bitmap[0] &= ~FATTR4_WORD0_FILEHANDLE; - return 0; - } - - memset(fh, 0, sizeof(*fh)); + if (fh != NULL) + memset(fh, 0, sizeof(*fh)); if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEHANDLE - 1U))) return -EIO; @@ -2899,11 +2895,13 @@ static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, stru len = be32_to_cpup(p); if (len > NFS4_FHSIZE) return -EIO; - fh->size = len; p = xdr_inline_decode(xdr, len); if (unlikely(!p)) goto out_overflow; - memcpy(fh->data, p, len); + if (fh != NULL) { + memcpy(fh->data, p, len); + fh->size = len; + } bitmap[0] &= ~FATTR4_WORD0_FILEHANDLE; } return 0; |