]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iov_iter: fix copy_page_to_iter_nofault()
authorOmar Sandoval <osandov@fb.com>
Fri, 17 Nov 2023 21:38:46 +0000 (13:38 -0800)
committerChristian Brauner <brauner@kernel.org>
Sat, 18 Nov 2023 15:42:07 +0000 (16:42 +0100)
commitfe2c34bab6d46469ad3095955dc37e984dc24e38
tree7e3ba304da7748545e8a5ec5cedab2baf58c6216
parent8a924db2d7b5eb69ba08b1a0af46e9f1359a9bdf
iov_iter: fix copy_page_to_iter_nofault()

The recent conversion to inline functions made two mistakes:

1. It tries to copy the full amount requested (bytes), not just what's
   available in the kmap'd page (n).
2. It's not applying the offset in the first page.

Note that copy_page_to_iter_nofault() is only used by /proc/kcore. This
was detected by drgn's test suite.

Fixes: f1982740f5e7 ("iov_iter: Convert iterate*() to inline funcs")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Link: https://lore.kernel.org/r/c1616e06b5248013cbbb1881bb4fef85a7a69ccb.1700257019.git.osandov@fb.com
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
lib/iov_iter.c