From: Jeff Layton Date: Fri, 5 Aug 2011 13:02:40 +0000 (-0400) Subject: cifs: cope with negative dentries in cifs_get_root X-Git-Tag: v3.0.2~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cae28d950cc7319a7e88deccbb0c4492f0830e6e;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git cifs: cope with negative dentries in cifs_get_root commit 80975d21aae2136ccae1ce914a1602dc1d8b0795 upstream. The loop around lookup_one_len doesn't handle the case where it might return a negative dentry, which can cause an oops on the next pass through the loop. Check for that and break out of the loop with an error of -ENOENT if there is one. Fixes the panic reported here: https://bugzilla.redhat.com/show_bug.cgi?id=727927 Reported-by: TR Bentley Reported-by: Iain Arnell Cc: Al Viro Signed-off-by: Jeff Layton Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index bc4b12c..fc7e57b 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -581,6 +581,10 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) mutex_unlock(&dir->i_mutex); dput(dentry); dentry = child; + if (!dentry->d_inode) { + dput(dentry); + dentry = ERR_PTR(-ENOENT); + } } while (!IS_ERR(dentry)); _FreeXid(xid); kfree(full_path);