cifs: don't allow cifs_iget to match inodes of the wrong type
authorJeff Layton <jlayton@redhat.com>
Mon, 19 Jul 2010 22:00:17 +0000 (18:00 -0400)
committerSteve French <sfrench@us.ibm.com>
Mon, 2 Aug 2010 12:40:39 +0000 (12:40 +0000)
If the type is different from what we think it should be, then don't
match the existing inode.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/inode.c

index 2d9cd2f269eba0383b29fc5c02875b832f5f0563..a15b3a9bbff40af95532b152a5bbf993a44bac99 100644 (file)
@@ -724,9 +724,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