Commit 25a8424c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] range checking in rd_open()

If you open /dev/ram7 when the kernel is configured for 4 ramdisks, things
blow up.  Teach rd_open() to check that the minor is in range.
parent 561516c8
......@@ -269,7 +269,10 @@ static struct backing_dev_info rd_backing_dev_info = {
static int rd_open(struct inode * inode, struct file * filp)
{
int unit = minor(inode->i_rdev);
unsigned unit = minor(inode->i_rdev);
if (unit >= NUM_RAMDISKS)
return -ENODEV;
/*
* Immunize device against invalidate_buffers() and prune_icache().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment