Skip to content

Commit 9de4ee4

Browse files
Dan Carpenteraxboe
Dan Carpenter
authored andcommitted
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>
1 parent 72961c4 commit 9de4ee4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: drivers/cdrom/cdrom.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2371,7 +2371,7 @@ static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi,
23712371
if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT)
23722372
return media_changed(cdi, 1);
23732373

2374-
if ((unsigned int)arg >= cdi->capacity)
2374+
if (arg >= cdi->capacity)
23752375
return -EINVAL;
23762376

23772377
info = kmalloc(sizeof(*info), GFP_KERNEL);

0 commit comments

Comments
 (0)