diff options
author | Pavel Shilovsky <piastryyy@gmail.com> | 2011-08-21 19:30:15 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-25 07:10:15 +0200 |
commit | f24d5457bd706667951021530dd0590a1f3e9464 (patch) | |
tree | 8547e64f3ee5e9e1a5222d92489c338a42297587 | |
parent | 726e2766e04f31620d61cbb8bd9fbf7abe962d02 (diff) | |
download | linux-stable-f24d5457bd706667951021530dd0590a1f3e9464.tar.gz linux-stable-f24d5457bd706667951021530dd0590a1f3e9464.tar.bz2 linux-stable-f24d5457bd706667951021530dd0590a1f3e9464.zip |
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>
-rw-r--r-- | fs/cifs/cifsfs.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index fc7e57b3f385..53e7d72177d2 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) struct inode *dir = dentry->d_inode; struct dentry *child; + if (!dir) { + dput(dentry); + dentry = ERR_PTR(-ENOENT); + break; + } + /* skip separators */ while (*s == sep) s++; @@ -581,10 +587,6 @@ 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); |