summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-07-19 18:00:17 -0400
committerSteve French <sfrench@us.ibm.com>2010-08-02 12:40:39 +0000
commitf30b9c11847cb6bf1f7aa65b5c436800621a07dd (patch)
tree753905eaaa4999d7afc82f251f8db872753fbf1e /fs
parent9f841593ff65d2f801c7f80c4ed0955d30103f50 (diff)
downloadkernel-f30b9c11847cb6bf1f7aa65b5c436800621a07dd.tar.gz
cifs: don't allow cifs_iget to match inodes of the wrong type
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/inode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 2d9cd2f269eb..a15b3a9bbff4 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -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