Patch "nfsd: Limit end of page list when decoding NFSv4 WRITE" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
nfsd: Limit end of page list when decoding NFSv4 WRITE
to the 4.9-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:
nfsd-limit-end-of-page-list-when-decoding-nfsv4-write.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
fc788f64f1f3eb31e87d4f53bcf1ab76590d5838Mon Sep 17 00:00:00 2001
From: Chuck Lever <[email protected]>
Date: Fri, 18 Aug 2017 11:12:19 -0400
Subject: nfsd: Limit end of page list when decoding NFSv4 WRITE
From: Chuck Lever <[email protected]>
commit fc788f64f1f3eb31e87d4f53bcf1ab76590d5838 upstream.
When processing an NFSv4 WRITE operation, argp->end should never point past the end of the data in the final page of the page list. Otherwise, nfsd4_decode_compound can walk into uninitialized memory.
More critical, nfsd4_decode_write is failing to increment argp->pagelen when it increments argp->pagelist. This can cause later xdr decoders to assume more data is available than really is, which can cause server crashes on malformed requests.
--- fs/nfsd/nfs4xdr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4xdr.c +2 -4
@@ -129,7 +129,7 @@ static void next_decode_page(struct nfsd argp->p =page_address (argp->pagelist[0 ]); argp->pagelist++;if (argp->pagelen <PAGE_SIZE ) { - argp->end = argp->p + (argp->pagelen>>2 ); + argp->end = argp->p +XDR_QUADLEN (argp->pagelen); argp->pagelen =0 ; }else { argp->end = argp->p + (PAGE_SIZE >>2 );
@@ -1246,9 +1246,7 @@ nfsd4_decode_write(struct nfsd4_compound argp->pagelen -= pages *PAGE_SIZE ; len -= pages *PAGE_SIZE ; - argp->p = (__be32 *)page_address (argp->pagelist[0 ]); - argp->pagelist++; - argp->end = argp->p +XDR_QUADLEN (PAGE_SIZE ); +next_decode_page (argp); } argp->p +=XDR_QUADLEN (len);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/nfsd-limit-end-of-page-list-when-decoding-nfsv4-write.patch