linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: linux-cifs@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/3] cifs: don't allow cifs_iget to match inodes of the wrong type
Date: Mon, 28 Jun 2010 07:10:11 -0400	[thread overview]
Message-ID: <1277723413-23769-2-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1277723413-23769-1-git-send-email-jlayton@redhat.com>

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>
---
 fs/cifs/inode.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

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
-- 
1.6.6.1


  reply	other threads:[~2010-06-28 11:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28 11:10 [PATCH 0/3] cifs: tighten up cifs_iget matching criteria Jeff Layton
2010-06-28 11:10 ` Jeff Layton [this message]
     [not found] ` <1277723413-23769-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-28 11:10   ` [PATCH 2/3] cifs: use CreationTime like an i_generation field Jeff Layton
     [not found]     ` <1277723413-23769-3-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-28 13:26       ` Suresh Jayaraman
2010-06-28 13:47         ` Jeff Layton
2010-11-22 19:55     ` Jeff Layton
     [not found]       ` <AANLkTimtg0vFVQ5HGo+nq7rE=Z4Sob=z7LuVCMFgWdnv@mail.gmail.com>
     [not found]         ` <AANLkTimtg0vFVQ5HGo+nq7rE=Z4Sob=z7LuVCMFgWdnv-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-22 20:31           ` Jeff Layton
     [not found]             ` <20101122153125.68ee4ee6-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-11-22 20:59               ` Jeremy Allison
2010-12-07  1:55                 ` Jeff Layton
2010-06-28 11:10   ` [PATCH 3/3] cifs: reduce false positives with inode aliasing serverino autodisable Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1277723413-23769-2-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).