From: Anders Johansson <ajohansson@novell.com>
Subject: Oops in novfs:unlink_local
References: bnc#569071
Patch-mainline: no

Signed-off-by: Anders Johansson <ajohansson@novell.com>
Acked-by: Sankar P <psankar@novell.com>
---
 fs/novfs/daemon.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/fs/novfs/daemon.c
+++ b/fs/novfs/daemon.c
@@ -2046,14 +2046,14 @@ static long local_unlink(const char *pat
 	}
 	dentry = lookup_one_len(name, nd.path.dentry, strlen(name));
 	error = PTR_ERR(dentry);
-	DbgPrint("dentry %p", dentry);
-	if (!(dentry->d_inode->i_mode & S_IFLNK)) {
-		DbgPrint("%s not a link", name);
-		error=-ENOENT;
-		goto exit1;
-	}
 
 	if (!IS_ERR(dentry)) {
+		DbgPrint("dentry %p", dentry);
+		if (!(dentry->d_inode->i_mode & S_IFLNK)) {
+			DbgPrint("%s not a link", name);
+			error=-ENOENT;
+			goto exit1;
+		}
 		/* Why not before? Because we want correct error value */
 		if (nd.last.name[nd.last.len])
 			goto slashes;
