Commit b8db1592 authored by J. Bruce Fields's avatar J. Bruce Fields

lockd: fix decoding of TEST results

We fail to advance the read pointer when reading the stat.oh field that
identifies the lock-holder in a TEST result.

This turns out not to matter if the server is knfsd, which always
returns a zero-length field.  But other servers (Ganesha is an example)
may not do this.  The result is bad values in fcntl F_GETLK results.

Fix this.
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 0d4d6720
...@@ -128,24 +128,14 @@ static void encode_netobj(struct xdr_stream *xdr, ...@@ -128,24 +128,14 @@ static void encode_netobj(struct xdr_stream *xdr,
static int decode_netobj(struct xdr_stream *xdr, static int decode_netobj(struct xdr_stream *xdr,
struct xdr_netobj *obj) struct xdr_netobj *obj)
{ {
u32 length; ssize_t ret;
__be32 *p;
p = xdr_inline_decode(xdr, 4); ret = xdr_stream_decode_opaque_inline(xdr, (void *)&obj->data,
if (unlikely(p == NULL)) XDR_MAX_NETOBJ);
goto out_overflow; if (unlikely(ret < 0))
length = be32_to_cpup(p++); return -EIO;
if (unlikely(length > XDR_MAX_NETOBJ)) obj->len = ret;
goto out_size;
obj->len = length;
obj->data = (u8 *)p;
return 0; return 0;
out_size:
dprintk("NFS: returned netobj was too long: %u\n", length);
return -EIO;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
} }
/* /*
......
...@@ -125,24 +125,14 @@ static void encode_netobj(struct xdr_stream *xdr, ...@@ -125,24 +125,14 @@ static void encode_netobj(struct xdr_stream *xdr,
static int decode_netobj(struct xdr_stream *xdr, static int decode_netobj(struct xdr_stream *xdr,
struct xdr_netobj *obj) struct xdr_netobj *obj)
{ {
u32 length; ssize_t ret;
__be32 *p;
p = xdr_inline_decode(xdr, 4); ret = xdr_stream_decode_opaque_inline(xdr, (void *)&obj->data,
if (unlikely(p == NULL)) XDR_MAX_NETOBJ);
goto out_overflow; if (unlikely(ret < 0))
length = be32_to_cpup(p++); return -EIO;
if (unlikely(length > XDR_MAX_NETOBJ)) obj->len = ret;
goto out_size;
obj->len = length;
obj->data = (u8 *)p;
return 0; return 0;
out_size:
dprintk("NFS: returned netobj was too long: %u\n", length);
return -EIO;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment