From: Scott Bauer Date: Wed, 3 Oct 2018 06:29:00 +0000 (+0200) Subject: cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status X-Git-Tag: Ubuntu-4.15.0-39.42~43 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=sidebyside;h=00ab3ffb35c4472bc415dc90fc3a646c2b40630d;p=mirror_ubuntu-bionic-kernel.git cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status CVE-2018-16658 Like d88b6d04: "cdrom: information leak in cdrom_ioctl_media_changed()" There is another cast from unsigned long to int which causes a bounds check to fail with specially crafted input. The value is then used as an index in the slot array in cdrom_slot_status(). Signed-off-by: Scott Bauer Signed-off-by: Scott Bauer Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe (cherry picked from commit 8f3fafc9c2f0ece10832c25f7ffcb07c97a32ad4) Signed-off-by: Po-Hsu Lin Acked-by: Stefan Bader Acked-by: Kleber Sacilotto de Souza Signed-off-by: Kleber Sacilotto de Souza --- diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index cbee2e742795..f0534a4f00d0 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2542,7 +2542,7 @@ static int cdrom_ioctl_drive_status(struct cdrom_device_info *cdi, if (!CDROM_CAN(CDC_SELECT_DISC) || (arg == CDSL_CURRENT || arg == CDSL_NONE)) return cdi->ops->drive_status(cdi, CDSL_CURRENT); - if (((int)arg >= cdi->capacity)) + if (arg >= cdi->capacity) return -EINVAL; return cdrom_slot_status(cdi, arg); }