Linux block layer
 help / color / mirror / Atom feed
From: Scott Bauer <scott.bauer@intel.com>
To: axboe@kernel.dk
Cc: hch@infradead.org, dan.carpenter@oracle.com,
	linux-block@vger.kernel.org, Scott Bauer <scott.bauer@intel.com>,
	Scott Bauer <sbauer@plzdonthack.me>,
	stable@vger.kernel.org
Subject: [PATCH] cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status
Date: Thu, 26 Apr 2018 11:51:08 -0600	[thread overview]
Message-ID: <20180426175108.29280-1-scott.bauer@intel.com> (raw)

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 <scott.bauer@intel.com>
Signed-off-by: Scott Bauer <sbauer@plzdonthack.me>
Cc: stable@vger.kernel.org
---
 drivers/cdrom/cdrom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index bfc566d3f31a..8cfa10ab7abc 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);
 }
-- 
2.14.1

             reply	other threads:[~2018-04-26 17:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 17:51 Scott Bauer [this message]
2018-04-27 12:41 ` [PATCH] cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status Dan Carpenter
2018-04-27 14:43   ` Scott Bauer
2018-04-27 15:13     ` Dan Carpenter
2018-08-29 12:48 ` Dan Carpenter
2018-08-29 14:09   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180426175108.29280-1-scott.bauer@intel.com \
    --to=scott.bauer@intel.com \
    --cc=axboe@kernel.dk \
    --cc=dan.carpenter@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=sbauer@plzdonthack.me \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox