Skip to content

Commit

Permalink
nfs: reject changes to resvport and sharecache during remount
Browse files Browse the repository at this point in the history
Commit c8e4702 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: c8e4702 (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>
  • Loading branch information
Scott Mayhew authored and Trond Myklebust committed Aug 4, 2014
1 parent 5b53dc8 commit 71a6ec8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2179,23 +2179,24 @@ static int nfs_validate_text_mount_data(void *options,
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 \
| NFS_MOUNT_KERBEROS \
| 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 ||
Expand Down

0 comments on commit 71a6ec8

Please sign in to comment.