From mboxrd@z Thu Jan 1 00:00:00 1970 From: NeilBrown Subject: [PATCH 002 of 5] knfsd: nfsd4: fix open permission checking Date: Tue, 17 Oct 2006 09:30:15 +1000 Message-ID: <1061016233015.11330@suse.de> References: <20061017092702.11224.patches@notabene> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org Return-path: Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list2-new.sourceforge.net with esmtp (Exim 4.43) id 1GZbuY-00016Y-1B for nfs@lists.sourceforge.net; Mon, 16 Oct 2006 16:30:22 -0700 Received: from cantor2.suse.de ([195.135.220.15] helo=mx2.suse.de) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1GZbuX-00072g-9t for nfs@lists.sourceforge.net; Mon, 16 Oct 2006 16:30:23 -0700 To: Andrew Morton List-Id: "Discussion of NFS under Linux development, interoperability, and testing." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfs-bounces@lists.sourceforge.net Errors-To: nfs-bounces@lists.sourceforge.net From: "J. Bruce Fields" We weren't actually checking for SHARE_ACCESS_WRITE, with the result that the owner could open a non-writeable file for write! Continue to allow DENY_WRITE only with write access. Thanks to Jim Rees for reporting the bug. Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown ### Diffstat output ./fs/nfsd/nfs4proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff .prev/fs/nfsd/nfs4proc.c ./fs/nfsd/nfs4proc.c --- .prev/fs/nfsd/nfs4proc.c 2006-10-17 09:02:26.000000000 +1000 +++ ./fs/nfsd/nfs4proc.c 2006-10-17 09:04:13.000000000 +1000 @@ -78,8 +78,10 @@ do_open_permission(struct svc_rqst *rqst if (open->op_share_access & NFS4_SHARE_ACCESS_READ) accmode |= MAY_READ; - if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) + if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) accmode |= (MAY_WRITE | MAY_TRUNC); + if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) + accmode |= MAY_WRITE; status = fh_verify(rqstp, current_fh, S_IFREG, accmode); ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422929AbWJPXbO (ORCPT ); Mon, 16 Oct 2006 19:31:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750814AbWJPXaq (ORCPT ); Mon, 16 Oct 2006 19:30:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:41415 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1422929AbWJPXaU (ORCPT ); Mon, 16 Oct 2006 19:30:20 -0400 From: NeilBrown To: Andrew Morton Date: Tue, 17 Oct 2006 09:30:15 +1000 Message-Id: <1061016233015.11330@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org From: "J. Bruce Fields" We weren't actually checking for SHARE_ACCESS_WRITE, with the result that the owner could open a non-writeable file for write! Continue to allow DENY_WRITE only with write access. Thanks to Jim Rees for reporting the bug. Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown ### Diffstat output ./fs/nfsd/nfs4proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff .prev/fs/nfsd/nfs4proc.c ./fs/nfsd/nfs4proc.c --- .prev/fs/nfsd/nfs4proc.c 2006-10-17 09:02:26.000000000 +1000 +++ ./fs/nfsd/nfs4proc.c 2006-10-17 09:04:13.000000000 +1000 @@ -78,8 +78,10 @@ do_open_permission(struct svc_rqst *rqst if (open->op_share_access & NFS4_SHARE_ACCESS_READ) accmode |= MAY_READ; - if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) + if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) accmode |= (MAY_WRITE | MAY_TRUNC); + if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) + accmode |= MAY_WRITE; status = fh_verify(rqstp, current_fh, S_IFREG, accmode);