cdrom: information leak in cdrom_ioctl_media_changed()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 18 Apr 2018 09:51:31 +0000 (12:51 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 31 May 2018 23:30:04 +0000 (00:30 +0100)
commit15bad6c8291a04692b928e9037844fde6f32a798
tree158632b243b491b232deb6bbf7ddd7c6d5d3172d
parent5a1f747c7f58e9820ebfb6b4811934a1f48bc4fe
cdrom: information leak in cdrom_ioctl_media_changed()

commit 9de4ee40547fd315d4a0ed1dd15a2fa3559ad707 upstream.

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>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/cdrom/cdrom.c