[PATCH] lookup_dentry() oops fix for pre-2.1.45-7

Jan Kratochvil (short@k332.feld.cvut.cz)
Wed, 16 Jul 1997 16:27:46 +0200 (MET DST)


Hi all!

Here's the diff against pre-patch-2.1.45-7 (and probably all the previous
ones) for preventing an oops in fs/namei.c/lookup_dentry() during
symlink dereferencing on some sort of a more complicated broken link
(target doesn't exist). I only hope this is the correct error handling.
Second simple fix is just to make this pre-patch compilable (congratulations
Linus - again!).

Jan "Lace" Kratochvil

P.S.: If someone applied my procps patch announced several days ago -
- there's a little bug (used swap always = 0). Upgrade to procps-1.12
recommended anyway. So simple fix and even in it a bug, aargh!

diff -ru /hdc2/x/linux-2.1.45-7/fs/namei.c linux/fs/namei.c
--- /hdc2/x/linux-2.1.45-7/fs/namei.c Wed Jul 16 16:15:48 1997
+++ linux/fs/namei.c Wed Jul 16 14:58:05 1997
@@ -434,7 +434,7 @@
break;

base = do_follow_link(base, dentry);
- if (c)
+ if (!IS_ERR(base) && c)
continue;

return base;
diff -ru /hdc2/x/linux-2.1.45-7/include/linux/dcache.h linux/include/linux/dcache.h
--- /hdc2/x/linux-2.1.45-7/include/linux/dcache.h Wed Jul 16 16:15:49 1997
+++ linux/include/linux/dcache.h Wed Jul 16 14:15:45 1997
@@ -65,7 +65,7 @@
* to invalidate a dentry for some reason (NFS
* timeouts or autofs deletes).
*/
-inline void d_drop(struct dentry * dentry)
+static inline void d_drop(struct dentry * dentry)
{
list_del(&dentry->d_hash);
INIT_LIST_HEAD(&dentry->d_hash);