splice: Apply generic position and size checks to each write
authorBen Hutchings <ben@decadent.org.uk>
Thu, 29 Jan 2015 02:50:33 +0000 (02:50 +0000)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:07:54 +0000 (13:07 +0000)
commitc3bd535294cbfec09c6ef0373f5311e87b7bc0a1
treeabbd82db08109dc6e595066481e647fa8ea8b7a8
parent7fd75a8d38bbebb61b23e2e2e88d8521933af081
splice: Apply generic position and size checks to each write

commit 894c6350eaad7e613ae267504014a456e00a3e2a from the 3.2-stable branch.

We need to check the position and size of file writes against various
limits, using generic_write_check().  This was not being done for
the splice write path.  It was fixed upstream by commit 8d0207652cbe
("->splice_write() via ->write_iter()") but we can't apply that.

CVE-2014-7822

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[Ben fixed it in 3.2 stable, i ported it to 3.10 stable]
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ocfs2/file.c
fs/splice.c