@@ -2818,11 +2818,11 @@ static __be32 nfsd4_encode_nfsace4(struct xdr_stream *xdr, struct svc_rqst *rqst
28182818#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
28192819static inline __be32
28202820nfsd4_encode_security_label (struct xdr_stream * xdr , struct svc_rqst * rqstp ,
2821- void * context , int len )
2821+ const struct lsm_context * context )
28222822{
28232823 __be32 * p ;
28242824
2825- p = xdr_reserve_space (xdr , len + 4 + 4 + 4 );
2825+ p = xdr_reserve_space (xdr , context -> len + 4 + 4 + 4 );
28262826 if (!p )
28272827 return nfserr_resource ;
28282828
@@ -2832,13 +2832,13 @@ nfsd4_encode_security_label(struct xdr_stream *xdr, struct svc_rqst *rqstp,
28322832 */
28332833 * p ++ = cpu_to_be32 (0 ); /* lfs */
28342834 * p ++ = cpu_to_be32 (0 ); /* pi */
2835- p = xdr_encode_opaque (p , context , len );
2835+ p = xdr_encode_opaque (p , context -> context , context -> len );
28362836 return 0 ;
28372837}
28382838#else
28392839static inline __be32
28402840nfsd4_encode_security_label (struct xdr_stream * xdr , struct svc_rqst * rqstp ,
2841- void * context , int len )
2841+ struct lsm_context * context )
28422842{ return 0 ; }
28432843#endif
28442844
@@ -2920,8 +2920,7 @@ struct nfsd4_fattr_args {
29202920 struct kstatfs statfs ;
29212921 struct nfs4_acl * acl ;
29222922#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2923- void * context ;
2924- int contextlen ;
2923+ struct lsm_context context ;
29252924#endif
29262925 u32 rdattr_err ;
29272926 bool contextsupport ;
@@ -3376,8 +3375,7 @@ static __be32 nfsd4_encode_fattr4_suppattr_exclcreat(struct xdr_stream *xdr,
33763375static __be32 nfsd4_encode_fattr4_sec_label (struct xdr_stream * xdr ,
33773376 const struct nfsd4_fattr_args * args )
33783377{
3379- return nfsd4_encode_security_label (xdr , args -> rqstp ,
3380- args -> context , args -> contextlen );
3378+ return nfsd4_encode_security_label (xdr , args -> rqstp , & args -> context );
33813379}
33823380#endif
33833381
@@ -3527,7 +3525,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
35273525 args .ignore_crossmnt = (ignore_crossmnt != 0 );
35283526 args .acl = NULL ;
35293527#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3530- args .context = NULL ;
3528+ args .context . context = NULL ;
35313529#endif
35323530
35333531 /*
@@ -3607,7 +3605,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
36073605 attrmask [0 ] & FATTR4_WORD0_SUPPORTED_ATTRS ) {
36083606 if (exp -> ex_flags & NFSEXP_SECURITY_LABEL )
36093607 err = security_inode_getsecctx (d_inode (dentry ),
3610- & args .context , & args . contextlen );
3608+ & args .context );
36113609 else
36123610 err = - EOPNOTSUPP ;
36133611 args .contextsupport = (err == 0 );
@@ -3644,12 +3642,8 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
36443642
36453643out :
36463644#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3647- if (args .context ) {
3648- struct lsm_context scaff ; /* scaffolding */
3649-
3650- lsmcontext_init (& scaff , args .context , args .contextlen , 0 );
3651- security_release_secctx (& scaff );
3652- }
3645+ if (args .context .context )
3646+ security_release_secctx (& args .context );
36533647#endif /* CONFIG_NFSD_V4_SECURITY_LABEL */
36543648 kfree (args .acl );
36553649 if (tempfh ) {
0 commit comments