From patchwork Thu Dec 11 20:30:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Coddington X-Patchwork-Id: 5477531 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ADB989F1CD for ; Thu, 11 Dec 2014 20:35:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1CA4201C8 for ; Thu, 11 Dec 2014 20:35:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0582E201C7 for ; Thu, 11 Dec 2014 20:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933721AbaLKUfK (ORCPT ); Thu, 11 Dec 2014 15:35:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40936 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932975AbaLKUfJ (ORCPT ); Thu, 11 Dec 2014 15:35:09 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBBKZ8bH022241 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 11 Dec 2014 15:35:08 -0500 Received: from bcodding-csb.redhat.com (vpn-54-120.rdu2.redhat.com [10.10.54.120]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBBKZ7Lt019532; Thu, 11 Dec 2014 15:35:08 -0500 Received: by bcodding-csb.redhat.com (Postfix, from userid 24008) id 652B9843BA; Thu, 11 Dec 2014 15:30:29 -0500 (EST) From: Benjamin Coddington To: linux-nfs@vger.kernel.org Cc: Jeff Layton Subject: [PATCH] nfs: verify open flags before allowing open Date: Thu, 11 Dec 2014 15:30:29 -0500 Message-Id: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix another path for: 9597c13b nfs: verify open flags before allowing an atomic open which forbade the NFSv4 open for O_DIRECT|O_APPEND in nfs_atomic_open(). That code path is missed when a cached positive dentry exists; nfs4_file_open() is used instead. Duplicate the forbid in nfs4_file_open(). Signed-off-by: Benjamin Coddington Cc: Jeff Layton --- fs/nfs/nfs4file.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index c51fb4d..c2e4767 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -37,6 +37,10 @@ nfs4_file_open(struct inode *inode, struct file *filp) dprintk("NFS: open file(%pd2)\n", dentry); + err = nfs_check_flags(openflags); + if (err) + return err; + if ((openflags & O_ACCMODE) == 3) openflags--;