]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pipe: iovec: Fix memory corruption when retrying atomic copy as non-atomic
authorBen Hutchings <ben@decadent.org.uk>
Tue, 16 Jun 2015 21:11:06 +0000 (22:11 +0100)
committerJiri Slaby <jslaby@suse.cz>
Thu, 30 Jul 2015 11:21:22 +0000 (13:21 +0200)
commite3d4ed26cd9d7a3a162ba8cf04e6a1db4e25ee94
tree588d075de33970c23a8321e970d145944a1eccf4
parent7ae9f79d2675a03964293f131fcb06bb07de2881
pipe: iovec: Fix memory corruption when retrying atomic copy as non-atomic

pipe_iov_copy_{from,to}_user() may be tried twice with the same iovec,
the first time atomically and the second time not.  The second attempt
needs to continue from the iovec position, pipe buffer offset and
remaining length where the first attempt failed, but currently the
pipe buffer offset and remaining length are reset.  This will corrupt
the piped data (possibly also leading to an information leak between
processes) and may also corrupt kernel memory.

This was fixed upstream by commits f0d1bec9d58d ("new helper:
copy_page_from_iter()") and 637b58c2887e ("switch pipe_read() to
copy_page_to_iter()"), but those aren't suitable for stable.  This fix
for older kernel versions was made by Seth Jennings for RHEL and I
have extracted it from their update.

CVE-2015-1805

References: https://bugzilla.redhat.com/show_bug.cgi?id=1202855
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/pipe.c