]> git.baikalelectronics.ru Git - kernel.git/commit
soc: aspeed: p2a-ctrl: Fix boundary check for mmap
authorIwona Winiarska <iwona.winiarska@intel.com>
Tue, 3 Aug 2021 23:48:19 +0000 (01:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:20 +0000 (12:26 +0200)
commitd343cc0b2338011b1d56e53739b6cc12cf969f6a
tree0022319e98d3ecd951d73edb7e3a4b78a2d58a42
parentc465bdc306106b06906f91102a9c360df067f909
soc: aspeed: p2a-ctrl: Fix boundary check for mmap

commit 8b07e990fb254fcbaa919616ac77f981cb48c73d upstream.

The check mixes pages (vm_pgoff) with bytes (vm_start, vm_end) on one
side of the comparison, and uses resource address (rather than just the
resource size) on the other side of the comparison.
This can allow malicious userspace to easily bypass the boundary check and
map pages that are located outside memory-region reserved by the driver.

Fixes: db8624935d9c ("drivers/misc: Add Aspeed P2A control driver")
Cc: stable@vger.kernel.org
Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Tested-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Joel Stanley <joel@aj.id.au>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/soc/aspeed/aspeed-p2a-ctrl.c