[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20111023062539.626776951@pistachio.kroah.org>
Date: Sun, 23 Oct 2011 08:24:43 +0200
From: Greg KH <gregkh@...e.de>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: stable-review@...r.kernel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, alan@...rguk.ukuu.org.uk,
Pavel Shilovsky <piastryyy@...il.com>,
Steve French <sfrench@...ibm.com>,
Josh Boyer <jwboyer@...hat.com>
Subject: [15/27] CIFS: Fix ERR_PTR dereference in cifs_get_root
3.0-stable review patch. If anyone has any objections, please let us know.
------------------
From: Pavel Shilovsky <piastryyy@...il.com>
commit 5b980b01212199833ee8023770fa4cbf1b85e9f4 upstream.
move it to the beginning of the loop.
Signed-off-by: Pavel Shilovsky <piastryyy@...il.com>
Reviewed-by: Jeff Layton <jlayton@...hat.com>
Signed-off-by: Steve French <sfrench@...ibm.com>
Cc: Josh Boyer <jwboyer@...hat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
fs/cifs/cifsfs.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -566,6 +566,12 @@ cifs_get_root(struct smb_vol *vol, struc
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, struc
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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists