]> git.baikalelectronics.ru Git - kernel.git/commit
drivers: char: mem: Fix wraparound check to allow mappings up to the end
authorJulius Werner <jwerner@chromium.org>
Fri, 2 Jun 2017 22:36:39 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Jun 2017 09:56:04 +0000 (18:56 +0900)
commit5b489912d62976820f38fc40c0c3bbf09556d029
tree4255951027e6489bdd33ce43f9fe477cd041b2e0
parentfbe30c2eaaaa1ecc0acf51fdd5b46341538e8cbb
drivers: char: mem: Fix wraparound check to allow mappings up to the end

A recent fix to /dev/mem prevents mappings from wrapping around the end
of physical address space. However, the check was written in a way that
also prevents a mapping reaching just up to the end of physical address
space, which may be a valid use case (especially on 32-bit systems).
This patch fixes it by checking the last mapped address (instead of the
first address behind that) for overflow.

Fixes: 0e5bcf13e8 ("drivers: char: mem: Check for address space wraparound with mmap()")
Cc: <stable@vger.kernel.org>
Reported-by: Nico Huber <nico.h@gmx.de>
Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/mem.c