From: Sankar P <psankar@novell.com>
Subject: novfs: fix an oops in novfs scope-finding code
References: bnc#588579
Patch-mainline: no

This patch removes an attempt to dereference a NULL pointer,
on failed memory allocation. The addscope boolean takes care
of the ScopeUserName field's validity.

Signed-off-by: Sankar P <psankar@novell.com>
Acked-by: Jan Kara <jack@suse.cz>
---
 fs/novfs/scope.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- a/fs/novfs/scope.c
+++ b/fs/novfs/scope.c
@@ -170,10 +170,9 @@ static struct novfs_scope_list *Scope_Fi
 				kfree(scope);
 				scope = NULL;
 			}
-		}
-
-		if (addscope) {
-			novfs_add_to_root(scope->ScopeUserName);
+			
+			if (scope && addscope)
+				novfs_add_to_root(scope->ScopeUserName);
 		}
 	}
 
