From patchwork Mon Jun 28 11:10:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 108337 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5SBBV5O001166 for ; Mon, 28 Jun 2010 11:11:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751641Ab0F1LLa (ORCPT ); Mon, 28 Jun 2010 07:11:30 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.122]:56167 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615Ab0F1LLa (ORCPT ); Mon, 28 Jun 2010 07:11:30 -0400 X-Authority-Analysis: v=1.1 cv=7qLQTOyu9xTBqhpUHgmrs7bafsFFGlkSRBtYgNIkZcY= c=1 sm=0 a=BWRTj6FJlCwA:10 a=Lw_SFsgOoS4A:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=f0Ao1HsFEWsEru40zwkA:9 a=jA-G-wx-h1ma0K4aTZzIl5vNObIA:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:50342] helo=mail.poochiereds.net) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id 39/BB-12872-513882C4; Mon, 28 Jun 2010 11:10:13 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 1C875580FD; Mon, 28 Jun 2010 07:10:13 -0400 (EDT) From: Jeff Layton 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 Message-Id: <1277723413-23769-2-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1277723413-23769-1-git-send-email-jlayton@redhat.com> References: <1277723413-23769-1-git-send-email-jlayton@redhat.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 28 Jun 2010 11:11:31 +0000 (UTC) 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