uv_mmtimer: keep the mapping of the RTC read-only

uv_mmtimer_mmap() refuses a writable mapping of the page with the real time
clock, which is a page of registers of the UV hub.  It leaves VM_MAYWRITE
set, though.  Who has opened the device for reading and writing can map the
page shared and read-only and then make the mapping writable with
mprotect(), which gives him the access to the hub registers that the check
is there to prevent.

Clear VM_MAYWRITE.  mprotect(PROT_WRITE) now fails with -EACCES on such a
mapping, on a private one too.

Fixes: fbd8ae106850 ("drivers/char/uv_mmtimer.c: add memory mapped RTC driver for UV")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 file changed