]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
SUNRPC: Fix xdr_encode_bool()
authorChuck Lever <chuck.lever@oracle.com>
Tue, 19 Jul 2022 13:18:35 +0000 (09:18 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 17 Oct 2022 09:57:17 +0000 (11:57 +0200)
BugLink: https://bugs.launchpad.net/bugs/1990564
commit c770f31d8f580ed4b965c64f924ec1cc50e41734 upstream.

I discovered that xdr_encode_bool() was returning the same address
that was passed in the @p parameter. The documenting comment states
that the intent is to return the address of the next buffer
location, just like the other "xdr_encode_*" helpers.

The result was the encoded results of NFSv3 PATHCONF operations were
not formed correctly.

Fixes: ded04a587f6c ("NFSD: Update the NFSv3 PATHCONF3res encoder to use struct xdr_stream")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
include/linux/sunrpc/xdr.h

index 4417f667c757e5e16be9d82b8696029687d30773..3a2c714d6b6290d6139822c01bf1ba76bba3e3fe 100644 (file)
@@ -405,8 +405,8 @@ static inline int xdr_stream_encode_item_absent(struct xdr_stream *xdr)
  */
 static inline __be32 *xdr_encode_bool(__be32 *p, u32 n)
 {
-       *p = n ? xdr_one : xdr_zero;
-       return p++;
+       *p++ = n ? xdr_one : xdr_zero;
+       return p;
 }
 
 /**