From: Jeff Layton Date: Mon, 19 Jul 2010 22:00:17 +0000 (-0400) Subject: cifs: don't allow cifs_iget to match inodes of the wrong type X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f30b9c11847cb6bf1f7aa65b5c436800621a07dd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Steve French --- 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