From: Sankar P <psankar@novell.com>
Subject: novfs: Fix for the issue of kernel dumps core on restart
References: bnc#641811
Patch-mainline: No

This patch fixes a bug that cause kernel to dump core on restart,
by rectifying the counter and dentry manipulation code.

Signed-off-by: Sankar P <psankar@novell.com>
Acked-by: Jan Kara <jack@suse.cz>

diff --git a/fs/novfs/daemon.c b/fs/novfs/daemon.c
index f0fd5d6..6e7fb5d 100644
--- a/fs/novfs/daemon.c
+++ b/fs/novfs/daemon.c
@@ -1857,14 +1857,15 @@ static long local_unlink(const char *pathname)
 	while (*c != '\0') {
 		if (*c == '/')
 			name = ++c;
-		c++;
+		else
+			c++;
 	}
 	dentry = lookup_one_len(name, nd.path.dentry, strlen(name));
 	error = PTR_ERR(dentry);
 
 	if (!IS_ERR(dentry)) {
 		DbgPrint("dentry %p", dentry);
-		if (!(dentry->d_inode->i_mode & S_IFLNK)) {
+		if (!(dentry->d_inode) || !(dentry->d_inode->i_mode & S_IFLNK)) {
 			DbgPrint("%s not a link", name);
 			error = -ENOENT;
 			goto exit1;
-- 
1.7.1

