diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-04-18 11:51:31 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-04-18 16:21:32 +0200 |
commit | 9de4ee40547fd315d4a0ed1dd15a2fa3559ad707 (patch) | |
tree | faa7e99e952977ce648ecf83f27821e456823e53 /drivers/cdrom/cdrom.c | |
parent | bfq-iosched: ensure to clear bic/bfqq pointers when preparing request (diff) | |
download | linux-9de4ee40547fd315d4a0ed1dd15a2fa3559ad707.tar.xz linux-9de4ee40547fd315d4a0ed1dd15a2fa3559ad707.zip |
cdrom: information leak in cdrom_ioctl_media_changed()
This cast is wrong. "cdi->capacity" is an int and "arg" is an unsigned
long. The way the check is written now, if one of the high 32 bits is
set then we could read outside the info->slots[] array.
This bug is pretty old and it predates git.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r-- | drivers/cdrom/cdrom.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 8327478effd0..bfc566d3f31a 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2371,7 +2371,7 @@ static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi, if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT) return media_changed(cdi, 1); - if ((unsigned int)arg >= cdi->capacity) + if (arg >= cdi->capacity) return -EINVAL; info = kmalloc(sizeof(*info), GFP_KERNEL); |