From: Dan Carpenter Date: Mon, 8 Oct 2018 10:57:36 +0000 (+0200) Subject: fbdev: sbuslib: integer overflow in sbusfb_ioctl_helper() X-Git-Tag: v4.20-rc1~47^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5017716adb8aa5c01c52386c1b7470101ffe9c5;p=thirdparty%2Fkernel%2Flinux.git fbdev: sbuslib: integer overflow in sbusfb_ioctl_helper() The "index + count" addition can overflow. Both come directly from the user. This bug leads to an information leak. Signed-off-by: Dan Carpenter Cc: Peter Malone Cc: Philippe Ombredanne Cc: Mathieu Malaterre Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c index 90c51330969c2..01a7110e61a76 100644 --- a/drivers/video/fbdev/sbuslib.c +++ b/drivers/video/fbdev/sbuslib.c @@ -171,7 +171,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, get_user(ublue, &c->blue)) return -EFAULT; - if (index + count > cmap->len) + if (index > cmap->len || count > cmap->len - index) return -EINVAL; for (i = 0; i < count; i++) {