]> git.baikalelectronics.ru Git - kernel.git/commit
rpc: fix xdr_truncate_encode to handle buffer ending on page boundary
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 22 Dec 2014 21:14:51 +0000 (16:14 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 7 Jan 2015 19:03:58 +0000 (14:03 -0500)
commitc8c4d0f2310f0438deaceb0e0bf8eff92b61f525
tree670d3bc2de3e9faec18f6fbc36f0a997f99a0992
parent3e33e144b1fbdd585e290cb9b8015af5ed4d5244
rpc: fix xdr_truncate_encode to handle buffer ending on page boundary

A struct xdr_stream at a page boundary might point to the end of one
page or the beginning of the next, but xdr_truncate_encode isn't
prepared to handle the former.

This can cause corruption of NFSv4 READDIR replies in the case that a
readdir entry that would have exceeded the client's dircount/maxcount
limit would have ended exactly on a 4k page boundary.  You're more
likely to hit this case on large directories.

Other xdr_truncate_encode callers are probably also affected.

Reported-by: Holger Hoffstätte <holger.hoffstaette@googlemail.com>
Tested-by: Holger Hoffstätte <holger.hoffstaette@googlemail.com>
Fixes: 10103504097e "rpc: xdr_truncate_encode"
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/xdr.c