All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: cope with negative dentries in cifs_get_root
@ 2011-08-05 13:02 Jeff Layton
  2011-08-05 15:03 ` Steve French
       [not found] ` <1312549360-4317-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Layton @ 2011-08-05 13:02 UTC (permalink / raw)
  To: smfrench; +Cc: viro, linux-cifs, linux-fsdevel

The loop around lookup_one_len doesn't handle the case where it might
return a negative dentry, which can cause an oops on the next pass
through the loop. Check for that and break out of the loop with an
error of -ENOENT if there is one.

Fixes the panic reported here:

    https://bugzilla.redhat.com/show_bug.cgi?id=727927

Reported-by: TR Bentley <home@trarbentley.net>
Reported-by: Iain Arnell <iarnell@gmail.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: stable@kernel.org
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifsfs.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 212e562..f93eb94 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -563,6 +563,10 @@ 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);
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-09  6:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 13:02 [PATCH] cifs: cope with negative dentries in cifs_get_root Jeff Layton
2011-08-05 15:03 ` Steve French
     [not found] ` <1312549360-4317-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-08-05 14:54   ` Al Viro
     [not found]     ` <20110805145428.GS2203-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2011-08-05 15:01       ` Steve French
     [not found]         ` <CAH2r5mvB8jyZnnSaGCs1Z=NWMCh6LQBpwTR3hY1Fv9pxw54+Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-05 15:15           ` Al Viro
2011-08-09  5:41   ` Pavel Shilovsky
     [not found]     ` <CAKywueRT9cGPu5pCiiYONd7DruBaE2TDvHVVyyELYwM_Ft5e+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-09  6:38       ` Al Viro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.