Re: bug in blkdev <-> VFS interaction. (oops) (fwd)

From: Alexander Viro (viro@math.psu.edu)
Date: Sat Sep 16 2000 - 11:07:08 EST


On Sat, 16 Sep 2000, Alain Knaff wrote:

> Ok, now could you tell me a way how to easily detect a "fake inode",
> and I rewrite my "restore ioctl functionality patch" in a way as not
> to break floppy root mounts.

s/root//

fake means NULL ->i_sb, nothing fancy about that. IS_RDONLY() used to be
very defensive and that's the only thing that didn't let this code blow
into your face from the very beginning. You can protect the call of
permission() with if (inode->i_sb). However, I still think that it's
bogus - after a look at the ioctl list it seems that most of them are
sysctls in disguise (come on, verbosity level for debugging printk()s as
ioctl()?)

Probably the clean solution would be to add a character device per
controller (/dev/fdc), turning eject /dev/fd0 into
% echo eject 0 > /dev/fdc0
etc. Then access control is done via permissions of /dev/fdc* - no need
to make the driver aware of VFS guts, layout of struct inode, etc.

I can do that. It doesn't require any modifications to the core part of
the driver (trivial character device glue + tiny parser calling the same
functions that fd_ioctl() calls), so it should be reasonably safe.
I would really like to know what uses floppy-specific ioctls, though -
look at the callers would probably clarify the situation.

Comments?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:13 EST