aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorPavel Shilovsky <piastryyy@gmail.com>2011-08-21 11:30:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-25 01:10:15 -0400
commitf24d5457bd706667951021530dd0590a1f3e9464 (patch)
tree8547e64f3ee5e9e1a5222d92489c338a42297587 /fs/cifs
parent726e2766e04f31620d61cbb8bd9fbf7abe962d02 (diff)
CIFS: Fix ERR_PTR dereference in cifs_get_root
commit 5b980b01212199833ee8023770fa4cbf1b85e9f4 upstream. 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> Cc: Josh Boyer <jwboyer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/cifs')
-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 fc7e57b3f38..53e7d72177d 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -566,6 +566,12 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
566 struct inode *dir = dentry->d_inode; 566 struct inode *dir = dentry->d_inode;
567 struct dentry *child; 567 struct dentry *child;
568 568
569 if (!dir) {
570 dput(dentry);
571 dentry = ERR_PTR(-ENOENT);
572 break;
573 }
574
569 /* skip separators */ 575 /* skip separators */
570 while (*s == sep) 576 while (*s == sep)
571 s++; 577 s++;
@@ -581,10 +587,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
581 mutex_unlock(&dir->i_mutex); 587 mutex_unlock(&dir->i_mutex);
582 dput(dentry); 588 dput(dentry);
583 dentry = child; 589 dentry = child;
584 if (!dentry->d_inode) {
585 dput(dentry);
586 dentry = ERR_PTR(-ENOENT);
587 }
588 } while (!IS_ERR(dentry)); 590 } while (!IS_ERR(dentry));
589 _FreeXid(xid); 591 _FreeXid(xid);
590 kfree(full_path); 592 kfree(full_path);