/dev/mem: Avoid overwriting "err" in read_mem()
authorKees Cook <keescook@chromium.org>
Tue, 27 Mar 2018 21:06:14 +0000 (14:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Apr 2018 12:26:31 +0000 (14:26 +0200)
commit5f834dd24baec1f9926e8a06609e0906fd607b06
treee64f64f6251c420150d82cc6387ab68c6b6e6b24
parent66a65ca5b8fda6f5c55a9cf83e0fcb8e613baaa9
/dev/mem: Avoid overwriting "err" in read_mem()

commit b5b38200ebe54879a7264cb6f33821f61c586a7e upstream.

Successes in probe_kernel_read() would mask failures in copy_to_user()
during read_mem().

Reported-by: Brad Spengler <spender@grsecurity.net>
Fixes: 22ec1a2aea73 ("/dev/mem: Add bounce buffer for copy-out")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/mem.c