From patchwork Wed Dec 21 00:19:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9482405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 994D5601C0 for ; Wed, 21 Dec 2016 00:20:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A16F283E8 for ; Wed, 21 Dec 2016 00:20:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F084283F0; Wed, 21 Dec 2016 00:20:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14B2A28404 for ; Wed, 21 Dec 2016 00:20:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752725AbcLUAUH (ORCPT ); Tue, 20 Dec 2016 19:20:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:44871 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbcLUAUH (ORCPT ); Tue, 20 Dec 2016 19:20:07 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C073CABDD; Wed, 21 Dec 2016 00:20:05 +0000 (UTC) From: NeilBrown To: Steve Dickson Date: Wed, 21 Dec 2016 11:19:14 +1100 Subject: [PATCH 2/4] nfsd: Do not permit manipulation of NFSv4.0, e.g. "-N 4.0" Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" Message-ID: <148227955395.31345.17174406788901291213.stgit@noble> In-Reply-To: <148227940052.31345.1974080582264239934.stgit@noble> References: <148227940052.31345.1974080582264239934.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The code maps this into "-4.32", which the kernel rejects. The kernel also rejects "-4.0" (when written to the 'versions' file). So require the minor number to be at least NFS4_MINMINOR, which is '1'. Signed-off-by: NeilBrown --- utils/nfsd/nfsd.c | 4 ++-- utils/nfsd/nfsd.man | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c index eb346f67f9e4..20f4b7952203 100644 --- a/utils/nfsd/nfsd.c +++ b/utils/nfsd/nfsd.c @@ -179,7 +179,7 @@ main(int argc, char **argv) case 4: if (*p == '.') { int i = atoi(p+1); - if (i > NFS4_MAXMINOR) { + if (i < NFS4_MINMINOR || i > NFS4_MAXMINOR) { fprintf(stderr, "%s: unsupported minor version\n", optarg); exit(1); } @@ -201,7 +201,7 @@ main(int argc, char **argv) case 4: if (*p == '.') { int i = atoi(p+1); - if (i > NFS4_MAXMINOR) { + if (i < NFS4_MINMINOR || i > NFS4_MAXMINOR) { fprintf(stderr, "%s: unsupported minor version\n", optarg); exit(1); } diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man index 8d198e25685e..8901fb6c6872 100644 --- a/utils/nfsd/nfsd.man +++ b/utils/nfsd/nfsd.man @@ -57,7 +57,7 @@ This option can be used to request that .B rpc.nfsd does not offer certain versions of NFS. The current version of .B rpc.nfsd -can support NFS versions 2,3,4 and the newer version 4.1. +can support major NFS versions 2,3,4 and the minor versions 4.1 and 4.2. .TP .B \-s " or " \-\-syslog By default, @@ -82,7 +82,7 @@ This option can be used to request that .B rpc.nfsd offer certain versions of NFS. The current version of .B rpc.nfsd -can support NFS versions 2,3,4 and the newer version 4.1. +can support major NFS versions 2,3,4 and the minor versions 4.1 and 4.2. .TP .B \-L " or " \-\-lease-time seconds Set the lease-time used for NFSv4. This corresponds to how often