Patch "NLM: Fix svcxdr_encode_owner()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    NLM: Fix svcxdr_encode_owner()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nlm-fix-svcxdr_encode_owner.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit eb46482aa9562c2681974f9c08fb460e6e5e6fe0
Author: Chuck Lever <chuck.lever@xxxxxxxxxx>
Date:   Thu Sep 16 17:24:54 2021 -0400

    NLM: Fix svcxdr_encode_owner()
    
    [ Upstream commit 89c485c7a3ecbc2ebd568f9c9c2edf3a8cf7485b ]
    
    Dai Ngo reports that, since the XDR overhaul, the NLM server crashes
    when the TEST procedure wants to return NLM_DENIED. There is a bug
    in svcxdr_encode_owner() that none of our standard test cases found.
    
    Replace the open-coded function with a call to an appropriate
    pre-fabricated XDR helper.
    
    Reported-by: Dai Ngo <Dai.Ngo@xxxxxxxxxx>
    Fixes: a6a63ca5652e ("lockd: Common NLM XDR helpers")
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/lockd/svcxdr.h b/fs/lockd/svcxdr.h
index c69a0bb76c940..4f1a451da5ba2 100644
--- a/fs/lockd/svcxdr.h
+++ b/fs/lockd/svcxdr.h
@@ -134,18 +134,9 @@ svcxdr_decode_owner(struct xdr_stream *xdr, struct xdr_netobj *obj)
 static inline bool
 svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj)
 {
-	unsigned int quadlen = XDR_QUADLEN(obj->len);
-	__be32 *p;
-
-	if (xdr_stream_encode_u32(xdr, obj->len) < 0)
-		return false;
-	p = xdr_reserve_space(xdr, obj->len);
-	if (!p)
+	if (obj->len > XDR_MAX_NETOBJ)
 		return false;
-	p[quadlen - 1] = 0;	/* XDR pad */
-	memcpy(p, obj->data, obj->len);
-
-	return true;
+	return xdr_stream_encode_opaque(xdr, obj->data, obj->len) > 0;
 }
 
 #endif /* _LOCKD_SVCXDR_H_ */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux