diff mbox

[1/3] cifs: don't allow cifs_iget to match inodes of the wrong type

Message ID 1277723413-23769-2-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton June 28, 2010, 11:10 a.m. UTC
None
diff mbox

Patch

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 6f0683c..f64b95f 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -723,9 +723,14 @@  cifs_find_inode(struct inode *inode, void *opaque)
 {
 	struct cifs_fattr *fattr = (struct cifs_fattr *) opaque;
 
+	/* don't match inode with different uniqueid */
 	if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid)
 		return 0;
 
+	/* don't match inode of different type */
+	if ((inode->i_mode & S_IFMT) != (fattr->cf_mode & S_IFMT))
+		return 0;
+
 	/*
 	 * uh oh -- it's a directory. We can't use it since hardlinked dirs are
 	 * verboten. Disable serverino and return it as if it were found, the