Commit 923a1b0f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ioctl(BLKBSZSET) fix and cleanup

From: Lou Langholtz <ldl@aros.net>

- set_blocksize() already does those size checks.

- test the set_blocksize() return value: it can fail if the requested
  blocksize is less that the hard sector size.
parent eda597e2
......@@ -166,13 +166,11 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
return -EINVAL;
if (get_user(n, (int *) arg))
return -EFAULT;
if (n > PAGE_SIZE || n < 512 || (n & (n - 1)))
return -EINVAL;
if (bd_claim(bdev, &holder) < 0)
return -EBUSY;
set_blocksize(bdev, n);
ret = set_blocksize(bdev, n);
bd_release(bdev);
return 0;
return ret;
case BLKPG:
return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg *) arg);
case BLKRRPART:
......
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