Re: [PATCH] Fix floppy ioctl (which were broken in 2.4.0-test5)

From: Alexander Viro (viro@math.psu.edu)
Date: Sat Sep 16 2000 - 09:05:30 EST


On Sat, 16 Sep 2000, Alain Knaff wrote:

> The following patch (against 2.4.0-test8) restores ioctl functionality,
> which has been broken in 2.4.0-test6-pre7:

I would reserve "broken" for original state. What's wrong with "if you
want write permissions to be checked during open() - open the bloody file
for write"? IOW, why on the Earth do we need magical semantics in this
case?

Moreover, permission(9) requires full-blown struct inode. Care to tell
what filesystem it should belong to when we are mounting the
root? BTW, you do realize that if root is mounted read-only your check
(for /dev/fd0) will give negative? permission(9) doesn't treat devices as
something special - open() does.

Another thing: you are defining new ->f_flags bits. Private to the
driver. It asks for trouble - they are invisible in fs.h and if somebody
would start adding new generic flags...

The bottom line being: permissions on floppy ioctls look like a serious
(and completely unnecessary) kludge. If you want open(2) check write
permissions - do what every normal UNIX program would do and pass the
O_RDWR or O_WRONLY - thay's why they are there, after all. Cleaner,
simpler and doesn't rely on permission(9) being able to cope with fake
inode.

        If you really want to have "deny if device node is on read-only
filesystem" (the only real difference between new and old behaviour) - I
would really like to hear the reason for that. I definitely see reasons
why it is bogus.

-
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:12 EST