Dear Linus,
Enclosed is a bug fix for 2.2.5.
The open() flag O_DIRECTORY is supposed to refuse to open
non-directories. However due to a logic error, with O_NOFOLLOW it will
open files and other things.
O_DIRECTORY|O_NOFOLLOW is not such a weird combination. In fact it's
the only conceivable use for O_DIRECTORY since you can use a trailing
slash instead if you want the link-following behaviour.
Patch, thoroughly tested, enclosed.
Enjoy,
-- Jamie
--- linux-2.2.5/fs/namei.c.o_dir Mon Jan 25 06:48:39 1999
+++ linux-2.2.5/fs/namei.c Wed Mar 31 18:25:50 1999
@@ -279,7 +279,8 @@
{
struct inode * inode = dentry->d_inode;
- if (inode && inode->i_op && inode->i_op->follow_link) {
+ if ((follow & LOOKUP_FOLLOW)
+ && inode && inode->i_op && inode->i_op->follow_link) {
if (current->link_count < 5) {
struct dentry * result;
@@ -402,9 +403,6 @@
/* Check mountpoints.. */
dentry = follow_mount(dentry);
-
- if (!(flags & LOOKUP_FOLLOW))
- break;
base = do_follow_link(base, dentry, flags);
if (IS_ERR(base))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/