6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aldo Ariel Panzardo commit 3f1181cb09c85499286c7f462d93530b0ebcafcc upstream. nfs4svc_encode_compoundres() copies the tag bytes into reserved XDR space and skips directly to the aligned end of the field. xdr_reserve_space() rounds the reservation up but does not initialize the padding bytes. A remote client can choose a tag length that is not a multiple of four, causing one to three stale bytes from the response page to be returned in the COMPOUND reply. Use xdr_encode_opaque_fixed() to copy the tag and clear its XDR padding. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Aldo Ariel Panzardo Reviewed-by: Jeff Layton Link: https://patch.msgid.link/20260915160049.3105481-1-qwe.aldo@gmail.com Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4xdr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -5922,8 +5922,7 @@ nfs4svc_encode_compoundres(struct svc_rq *p++ = resp->cstate.status; *p++ = htonl(resp->taglen); - memcpy(p, resp->tag, resp->taglen); - p += XDR_QUADLEN(resp->taglen); + p = xdr_encode_opaque_fixed(p, resp->tag, resp->taglen); *p++ = htonl(resp->opcnt); nfsd4_sequence_done(resp);