summaryrefslogtreecommitdiff
path: root/fs/msdos
diff options
context:
space:
mode:
authorHirofumi Ogawa <hirofumi@mail.parknet.co.jp>2002-05-24 20:31:46 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-05-24 20:31:46 -0700
commit79980093177a166328fa77a951217b999b3e8a75 (patch)
treea1a86b6c2b6bd0ea980bbe4b03f0940996af2095 /fs/msdos
parentbf1c989a47972d15804a9eecb0e2d6276b0178f0 (diff)
[PATCH] Fix the handling of dentry on msdos_lookup() (1/4)
If d_splice_alias() doesn't find the alias dentry, it returns NULL. Then, msdos_lookup() dereference the NULL, and Oopses. Fixed here. The vfat_lookup() part is cleanup only.
Diffstat (limited to 'fs/msdos')
-rw-r--r--fs/msdos/namei.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index b7fbe8be6b2a..12812cddda8a 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -222,22 +222,17 @@ struct dentry *msdos_lookup(struct inode *dir,struct dentry *dentry)
if (res)
goto out;
add:
- if (inode) {
- dentry = d_splice_alias(inode, dentry);
- dentry->d_op = &msdos_dentry_operations;
- } else {
- d_add(dentry, inode);
- dentry = NULL;
- }
res = 0;
+ dentry = d_splice_alias(inode, dentry);
+ if (dentry)
+ dentry->d_op = &msdos_dentry_operations;
out:
if (bh)
fat_brelse(sb, bh);
unlock_kernel();
- if (res)
- return ERR_PTR(res);
- else
+ if (!res)
return dentry;
+ return ERR_PTR(res);
}
/***** Creates a directory entry (name is already formatted). */