Commit deb2ae4a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix block layer ioctl bug

From: Alan Cox <alan@redhat.com>

The block layer checks for -EINVAL from block layer driver ioctls.  This is
wrong - ENOTTY is unknown and some drivers correctly use this.  I suspect
for an internal ioctl 2.7 should change to -ENOIOCTLCMD and bitch about old
style returns

This is conservative fix for the 2.6 case, it keeps the bogus -EINVAL to
avoid breaking stuff
parent 4539d2e4
...@@ -203,7 +203,8 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, ...@@ -203,7 +203,8 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
case BLKROSET: case BLKROSET:
if (disk->fops->ioctl) { if (disk->fops->ioctl) {
ret = disk->fops->ioctl(inode, file, cmd, arg); ret = disk->fops->ioctl(inode, file, cmd, arg);
if (ret != -EINVAL) /* -EINVAL to handle old uncorrected drivers */
if (ret != -EINVAL && ret != -ENOTTY)
return ret; return ret;
} }
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
......
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