]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nfs: reject changes to resvport and sharecache during remount
authorScott Mayhew <smayhew@redhat.com>
Mon, 4 Aug 2014 21:37:27 +0000 (17:37 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 4 Aug 2014 21:41:52 +0000 (17:41 -0400)
Commit c8e47028 made it possible to change resvport/noresvport and
sharecache/nosharecache via a remount operation, neither of which should be
allowed.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Fixes: c8e47028 (nfs: Apply NFS_MOUNT_CMP_FLAGMASK to nfs_compare_remount_data)
Cc: stable@vger.kernel.org # 3.16+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/super.c

index c08e837c29e5bd3a486e328b5070db90abb918b4..e4499d5b51e8f33a05fec43843c8648de834dfd7 100644 (file)
@@ -2179,7 +2179,7 @@ out_no_address:
        return -EINVAL;
 }
 
-#define NFS_MOUNT_CMP_FLAGMASK ~(NFS_MOUNT_INTR \
+#define NFS_REMOUNT_CMP_FLAGMASK ~(NFS_MOUNT_INTR \
                | NFS_MOUNT_SECURE \
                | NFS_MOUNT_TCP \
                | NFS_MOUNT_VER3 \
@@ -2187,15 +2187,16 @@ out_no_address:
                | NFS_MOUNT_NONLM \
                | NFS_MOUNT_BROKEN_SUID \
                | NFS_MOUNT_STRICTLOCK \
-               | NFS_MOUNT_UNSHARED \
-               | NFS_MOUNT_NORESVPORT \
                | NFS_MOUNT_LEGACY_INTERFACE)
 
+#define NFS_MOUNT_CMP_FLAGMASK (NFS_REMOUNT_CMP_FLAGMASK & \
+               ~(NFS_MOUNT_UNSHARED | NFS_MOUNT_NORESVPORT))
+
 static int
 nfs_compare_remount_data(struct nfs_server *nfss,
                         struct nfs_parsed_mount_data *data)
 {
-       if ((data->flags ^ nfss->flags) & NFS_MOUNT_CMP_FLAGMASK ||
+       if ((data->flags ^ nfss->flags) & NFS_REMOUNT_CMP_FLAGMASK ||
            data->rsize != nfss->rsize ||
            data->wsize != nfss->wsize ||
            data->version != nfss->nfs_client->rpc_ops->version ||