aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Shilovsky <piastryyy@gmail.com>2011-08-21 11:30:15 -0400
committerSteve French <sfrench@us.ibm.com>2011-09-19 22:15:03 -0400
commit5b980b01212199833ee8023770fa4cbf1b85e9f4 (patch)
tree71a184539229d6067185a3b57bebb6e422a7c48f /fs
parent9438fabb73eb48055b58b89fc51e0bc4db22fabd (diff)
CIFS: Fix ERR_PTR dereference in cifs_get_root
move it to the beginning of the loop. Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index f93eb948d071..54b8f1e7da94 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -548,6 +548,12 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
548 struct inode *dir = dentry->d_inode; 548 struct inode *dir = dentry->d_inode;
549 struct dentry *child; 549 struct dentry *child;
550 550
551 if (!dir) {
552 dput(dentry);
553 dentry = ERR_PTR(-ENOENT);
554 break;
555 }
556
551 /* skip separators */ 557 /* skip separators */
552 while (*s == sep) 558 while (*s == sep)
553 s++; 559 s++;
@@ -563,10 +569,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
563 mutex_unlock(&dir->i_mutex); 569 mutex_unlock(&dir->i_mutex);
564 dput(dentry); 570 dput(dentry);
565 dentry = child; 571 dentry = child;
566 if (!dentry->d_inode) {
567 dput(dentry);
568 dentry = ERR_PTR(-ENOENT);
569 }
570 } while (!IS_ERR(dentry)); 572 } while (!IS_ERR(dentry));
571 _FreeXid(xid); 573 _FreeXid(xid);
572 kfree(full_path); 574 kfree(full_path);