aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
authorDavid Quigley <dpquigl@davequigley.com>2013-05-22 12:50:44 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-06-08 16:20:16 -0400
commitaa9c2669626ca7e5e5bab28e6caeb583fd40099b (patch)
tree632e008011b5a8b75edf5a2f4c3c0daf464f0cc4 /fs/nfs/super.c
parent14c43f767818c42f91ec7ffa586ee975845f68c8 (diff)
NFS: Client implementation of Labeled-NFS
This patch implements the client transport and handling support for labeled NFS. The patch adds two functions to encode and decode the security label recommended attribute which makes use of the LSM hooks added earlier. It also adds code to grab the label from the file attribute structures and encode the label to be sent back to the server. Acked-by: James Morris <james.l.morris@oracle.com> Signed-off-by: Matthew N. Dodd <Matthew.Dodd@sparta.com> Signed-off-by: Miguel Rodel Felipe <Rodel_FM@dsi.a-star.edu.sg> Signed-off-by: Phua Eu Gene <PHUA_Eu_Gene@dsi.a-star.edu.sg> Signed-off-by: Khin Mi Mi Aung <Mi_Mi_AUNG@dsi.a-star.edu.sg> Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index b30c003b47d1..76e1ee5d03ed 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2417,8 +2417,21 @@ static int nfs_bdi_register(struct nfs_server *server)
2417int nfs_set_sb_security(struct super_block *s, struct dentry *mntroot, 2417int nfs_set_sb_security(struct super_block *s, struct dentry *mntroot,
2418 struct nfs_mount_info *mount_info) 2418 struct nfs_mount_info *mount_info)
2419{ 2419{
2420 return security_sb_set_mnt_opts(s, &mount_info->parsed->lsm_opts, 2420 int error;
2421 0, NULL); 2421 unsigned long kflags = 0, kflags_out = 0;
2422 if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL)
2423 kflags |= SECURITY_LSM_NATIVE_LABELS;
2424
2425 error = security_sb_set_mnt_opts(s, &mount_info->parsed->lsm_opts,
2426 kflags, &kflags_out);
2427 if (error)
2428 goto err;
2429
2430 if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL &&
2431 !(kflags_out & SECURITY_LSM_NATIVE_LABELS))
2432 NFS_SB(s)->caps &= ~NFS_CAP_SECURITY_LABEL;
2433err:
2434 return error;
2422} 2435}
2423EXPORT_SYMBOL_GPL(nfs_set_sb_security); 2436EXPORT_SYMBOL_GPL(nfs_set_sb_security);
2424 2437