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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 09:33:16 +0000 (11:33 +0200)
commit68c09d548bfc61aec99fa9a24e703c3d6fdba9b1
treee6be0618d2e1a3b1c21e02ee98942e2250200541
parentf4df47e36ac052e772899b0d141daed1c9b008ae
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>
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cdrom/cdrom.c