cifs: ensure that cifs_get_root() only traverses directories
[pandora-kernel.git] / fs / cifs / cifsfs.c
index b1451af..b3a2a40 100644 (file)
@@ -561,6 +561,11 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
                        dentry = ERR_PTR(-ENOENT);
                        break;
                }
+               if (!S_ISDIR(dir->i_mode)) {
+                       dput(dentry);
+                       dentry = ERR_PTR(-ENOTDIR);
+                       break;
+               }
 
                /* skip separators */
                while (*s == sep)