aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-01-16 15:05:44 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-01-27 15:51:15 -0500
commitdee972b967ae111ad5705733de17a3bfc4632311 (patch)
treeca4cd3da053a74fe15742d17b0d2d4f5903bd57b /fs
parent949db153b6466c6f7cad5a427ecea94985927311 (diff)
NFS: Fix error reporting in nfs_xdev_mount
Currently, nfs_xdev_mount converts all errors from clone_server() to ENOMEM, which can then leak to userspace (for instance to 'mount'). Fix that. Also ensure that if nfs_fs_mount_common() returns an error, we don't dprintk(0)... The regression originated in commit 3d176e3fe4f6dc379b252bf43e2e146a8f7caf01 (NFS: Use nfs_fs_mount_common() for xdev mounts) Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: stable@vger.kernel.org [>= 3.5]
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/super.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2e7e8c878e5d..b056b1628722 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2589,27 +2589,23 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags,
2589 struct nfs_server *server; 2589 struct nfs_server *server;
2590 struct dentry *mntroot = ERR_PTR(-ENOMEM); 2590 struct dentry *mntroot = ERR_PTR(-ENOMEM);
2591 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod; 2591 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod;
2592 int error;
2593 2592
2594 dprintk("--> nfs_xdev_mount_common()\n"); 2593 dprintk("--> nfs_xdev_mount()\n");
2595 2594
2596 mount_info.mntfh = mount_info.cloned->fh; 2595 mount_info.mntfh = mount_info.cloned->fh;
2597 2596
2598 /* create a new volume representation */ 2597 /* create a new volume representation */
2599 server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); 2598 server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor);
2600 if (IS_ERR(server)) {
2601 error = PTR_ERR(server);
2602 goto out_err;
2603 }
2604 2599
2605 mntroot = nfs_fs_mount_common(server, flags, dev_name, &mount_info, nfs_mod); 2600 if (IS_ERR(server))
2606 dprintk("<-- nfs_xdev_mount_common() = 0\n"); 2601 mntroot = ERR_CAST(server);
2607out: 2602 else
2608 return mntroot; 2603 mntroot = nfs_fs_mount_common(server, flags,
2604 dev_name, &mount_info, nfs_mod);
2609 2605
2610out_err: 2606 dprintk("<-- nfs_xdev_mount() = %ld\n",
2611 dprintk("<-- nfs_xdev_mount_common() = %d [error]\n", error); 2607 IS_ERR(mntroot) ? PTR_ERR(mntroot) : 0L);
2612 goto out; 2608 return mntroot;
2613} 2609}
2614 2610
2615#if IS_ENABLED(CONFIG_NFS_V4) 2611#if IS_ENABLED(CONFIG_NFS_V4)