lkml.org 
[lkml]   [1997]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subjectlookup_dentry broken
The lookup_dentry function in 2.1.46 does not return the correct error
when the last name component is not a directory but there is a trailing
slash or the name ends in "." or "..". Instead of returning ENOTDIR it
either returns EACCES or no error at all (if the file is executable). For
example, if "foo" is a plain executable file then "foo/", "foo/." and
"foo/.." are all accepted without error.

--- linux-2.1.46/fs/namei.c.~1~ Mon Jul 21 20:19:34 1997
+++ linux-2.1.46/fs/namei.c Wed Jul 23 00:22:24 1997
@@ -391,6 +391,9 @@
dentry = ERR_PTR(-ENOENT);
if (!base->d_inode)
break;
+ dentry = ERR_PTR(-ENOTDIR);
+ if (!S_ISDIR(base->d_inode->i_mode))
+ break;
this.name = name;
hash = init_name_hash();
len = 0;
@@ -421,9 +424,18 @@
break;

base = do_follow_link(base, dentry);
- if (c && !IS_ERR(base))
+ if (IS_ERR(base))
+ goto return_base;
+ if (c)
continue;
-
+ if (name[-1] == '/') {
+ dentry = ERR_PTR(-ENOENT);
+ if (!base->d_inode)
+ break;
+ dentry = ERR_PTR(-ENOTDIR);
+ if (!S_ISDIR(base->d_inode->i_mode))
+ break;
+ }
return_base:
return base;
}
--
Andreas Schwab "And now for something
schwab@issan.informatik.uni-dortmund.de completely different"

\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.043 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site