aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2008-05-02 16:42:42 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-05-16 12:43:27 -0400
commit46c8ac74250a396aca855e494f49a960797a6b5e (patch)
treeaa02bcbc7f332f97c202ee14f8497dcb7b9aa992 /fs/nfs
parent3a6258e1fb5ff717dcefa04afc35f81aaae3f3e0 (diff)
nfs/lsm: make NFSv4 set LSM mount options
NFSv3 get_sb operations call into the LSM layer to set security options passed from userspace. NFSv4 hooks were not originally added since it was reasonably late in the merge window and NFSv3 was the only thing that had regressed (v4 has never supported any LSM options) This patch makes NFSv4 call into the LSM to set security options rather than just blindly dropping them with no notice to the user as happens today. This patch was tested in a simple NFSv4 environment with the context= option and appeared to work as expected. Signed-off-by: Eric Paris <eparis@redhat.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: James Morris <jmorris@namei.org> Cc: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/super.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 7226a506f3ca..5ed86ac0fd9b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2015,6 +2015,10 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
2015 goto error_splat_super; 2015 goto error_splat_super;
2016 } 2016 }
2017 2017
2018 error = security_sb_set_mnt_opts(s, &data.lsm_opts);
2019 if (error)
2020 goto error_splat_root;
2021
2018 s->s_flags |= MS_ACTIVE; 2022 s->s_flags |= MS_ACTIVE;
2019 mnt->mnt_sb = s; 2023 mnt->mnt_sb = s;
2020 mnt->mnt_root = mntroot; 2024 mnt->mnt_root = mntroot;
@@ -2031,6 +2035,8 @@ out_free:
2031 nfs_free_server(server); 2035 nfs_free_server(server);
2032 goto out; 2036 goto out;
2033 2037
2038error_splat_root:
2039 dput(mntroot);
2034error_splat_super: 2040error_splat_super:
2035 up_write(&s->s_umount); 2041 up_write(&s->s_umount);
2036 deactivate_super(s); 2042 deactivate_super(s);
@@ -2114,6 +2120,8 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
2114 mnt->mnt_sb = s; 2120 mnt->mnt_sb = s;
2115 mnt->mnt_root = mntroot; 2121 mnt->mnt_root = mntroot;
2116 2122
2123 security_sb_clone_mnt_opts(data->sb, s);
2124
2117 dprintk("<-- nfs4_xdev_get_sb() = 0\n"); 2125 dprintk("<-- nfs4_xdev_get_sb() = 0\n");
2118 return 0; 2126 return 0;
2119 2127
@@ -2197,6 +2205,8 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
2197 mnt->mnt_sb = s; 2205 mnt->mnt_sb = s;
2198 mnt->mnt_root = mntroot; 2206 mnt->mnt_root = mntroot;
2199 2207
2208 security_sb_clone_mnt_opts(data->sb, s);
2209
2200 dprintk("<-- nfs4_referral_get_sb() = 0\n"); 2210 dprintk("<-- nfs4_referral_get_sb() = 0\n");
2201 return 0; 2211 return 0;
2202 2212