Skip to content

Commit 252a52a

Browse files
Dan Rosenbergtorvalds
authored andcommitted
Fix pktcdvd ioctl dev_minor range check
The PKT_CTRL_CMD_STATUS device ioctl retrieves a pointer to a pktcdvd_device from the global pkt_devs array. The index into this array is provided directly by the user and is a signed integer, so the comparison to ensure that it falls within the bounds of this array will fail when provided with a negative index. This can be used to read arbitrary kernel memory or cause a crash due to an invalid pointer dereference. This can be exploited by users with permission to open /dev/pktcdvd/control (on many distributions, this is readable by group "cdrom"). Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com> [ Rather than add a cast, just make the function take the right type -Linus ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 95929ef commit 252a52a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/pktcdvd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,7 @@ static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
23692369
pkt_shrink_pktlist(pd);
23702370
}
23712371

2372-
static struct pktcdvd_device *pkt_find_dev_from_minor(int dev_minor)
2372+
static struct pktcdvd_device *pkt_find_dev_from_minor(unsigned int dev_minor)
23732373
{
23742374
if (dev_minor >= MAX_WRITERS)
23752375
return NULL;

0 commit comments

Comments
 (0)