Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ad07353 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 4a201d6e
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -2883,11 +2883,7 @@ 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;
	}

	if (fh != NULL)
		memset(fh, 0, sizeof(*fh));

	if (unlikely(bitmap[0] & (FATTR4_WORD0_FILEHANDLE - 1U)))
@@ -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;
		if (fh != NULL) {
			memcpy(fh->data, p, len);
			fh->size = len;
		}
		bitmap[0] &= ~FATTR4_WORD0_FILEHANDLE;
	}
	return 0;