diff mbox series

[1/1] lockd: crashes in svcxdr_encode_owner

Message ID 20210915213300.25066-1-dai.ngo@oracle.com (mailing list archive)
State New, archived
Headers show
Series [1/1] lockd: crashes in svcxdr_encode_owner | expand

Commit Message

Dai Ngo Sept. 15, 2021, 9:33 p.m. UTC
svcxdr_encode_owner needs to handle case where no lock owner
info to pass back, obj->len == 0.

Fixes: a6a63ca5652e ("lockd: Common NLM XDR helpers")
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/lockd/svcxdr.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chuck Lever Sept. 15, 2021, 9:44 p.m. UTC | #1
Hi Dai-

> On Sep 15, 2021, at 5:33 PM, Dai Ngo <dai.ngo@oracle.com> wrote:
> 
> svcxdr_encode_owner needs to handle case where no lock owner
> info to pass back, obj->len == 0.
> 
> Fixes: a6a63ca5652e ("lockd: Common NLM XDR helpers")
> Signed-off-by: Dai Ngo <dai.ngo@oracle.com>

This seems like 5.15-rc material, so I will apply it to my -rc branch
once review is complete.


> ---
> fs/lockd/svcxdr.h | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/fs/lockd/svcxdr.h b/fs/lockd/svcxdr.h
> index c69a0bb76c94..04fde20ea8c1 100644
> --- a/fs/lockd/svcxdr.h
> +++ b/fs/lockd/svcxdr.h
> @@ -139,6 +139,8 @@ svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj)
> 
> 	if (xdr_stream_encode_u32(xdr, obj->len) < 0)
> 		return false;
> +	if (obj->len == 0)
> +		return true;
> 	p = xdr_reserve_space(xdr, obj->len);
> 	if (!p)
> 		return false;
> -- 
> 2.9.5
> 

--
Chuck Lever
diff mbox series

Patch

diff --git a/fs/lockd/svcxdr.h b/fs/lockd/svcxdr.h
index c69a0bb76c94..04fde20ea8c1 100644
--- a/fs/lockd/svcxdr.h
+++ b/fs/lockd/svcxdr.h
@@ -139,6 +139,8 @@  svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj)
 
 	if (xdr_stream_encode_u32(xdr, obj->len) < 0)
 		return false;
+	if (obj->len == 0)
+		return true;
 	p = xdr_reserve_space(xdr, obj->len);
 	if (!p)
 		return false;