From patchwork Tue Apr 2 21:45:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 2380501 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D91C6DF2A1 for ; Tue, 2 Apr 2013 21:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932755Ab3DBVqY (ORCPT ); Tue, 2 Apr 2013 17:46:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63496 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932638Ab3DBVqT (ORCPT ); Tue, 2 Apr 2013 17:46:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r32LkHxL015549 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Apr 2013 17:46:17 -0400 Received: from bighat.boston.devel.redhat.com ([10.16.60.55]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r32Lk15V011003; Tue, 2 Apr 2013 17:46:16 -0400 From: Steve Dickson To: Trond Myklebust , "J. Bruce Fields" , "David P. Quigley" Cc: Linux NFS list , Linux FS devel list , Linux Security List , SELinux List Subject: [PATCH 16/19] NFSv4.2: Only allocate labels on v4.2 mounts Date: Tue, 2 Apr 2013 17:45:57 -0400 Message-Id: <1364939160-20874-17-git-send-email-SteveD@redhat.com> In-Reply-To: <1364939160-20874-1-git-send-email-SteveD@redhat.com> References: <1364939160-20874-1-git-send-email-SteveD@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Steve Dickson Before allocating a label or security initialization make sure the v4 minor version is at least 2. Signed-off-by: Steve Dickson --- fs/nfs/inode.c | 4 ++++ fs/nfs/nfs4proc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 91920fc..cc1c85d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -287,6 +287,10 @@ void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { struct nfs4_label *label = NULL; + int minor_version = server->nfs_client->cl_minorversion; + + if (minor_version < 2) + return label; if (!(server->caps & NFS_CAP_SECURITY_LABEL)) return label; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b7eae1e..3e18d39 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -94,6 +94,10 @@ nfs4_label_init_security(struct inode *dir, struct dentry *dentry, struct iattr *sattr, struct nfs4_label *l) { int err; + int minor_version = NFS_SERVER(dir)->nfs_client->cl_minorversion; + + if (minor_version < 2) + return NULL; if (nfs_server_capable(dir, NFS_CAP_SECURITY_LABEL)) { err = security_dentry_init_security(dentry, sattr->ia_mode,