From 79980093177a166328fa77a951217b999b3e8a75 Mon Sep 17 00:00:00 2001 From: Hirofumi Ogawa Date: Fri, 24 May 2002 20:31:46 -0700 Subject: [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. --- fs/msdos/namei.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'fs/msdos') 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). */ -- cgit v1.2.3