android_kernel_samsung_a7y1.../drivers/misc/genwqe
Dan Carpenter b6812d3c04 genwqe: Prevent an integer overflow in the ioctl
commit 110080cea0d0e4dfdb0b536e7f8a5633ead6a781 upstream.

There are a couple potential integer overflows here.

	round_up(m->size + (m->addr & ~PAGE_MASK), PAGE_SIZE);

The first thing is that the "m->size + (...)" addition could overflow,
and the second is that round_up() overflows to zero if the result is
within PAGE_SIZE of the type max.

In this code, the "m->size" variable is an u64 but we're saving the
result in "map_size" which is an unsigned long and genwqe_user_vmap()
takes an unsigned long as well.  So I have used ULONG_MAX as the upper
bound.  From a practical perspective unsigned long is fine/better than
trying to change all the types to u64.

Fixes: eaf4722d4645 ("GenWQE Character device and DDCB queue")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 18:45:18 +02:00
..
card_base.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
card_base.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
card_ddcb.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
card_ddcb.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
card_debugfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
card_dev.c genwqe: Prevent an integer overflow in the ioctl 2020-04-06 18:45:18 +02:00
card_sysfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
card_utils.c genwqe: Prevent an integer overflow in the ioctl 2020-04-06 18:45:18 +02:00
genwqe_driver.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30