@@ -2894,6 +2894,10 @@ struct nfsd4_fattr_args {
2894
2894
struct kstatfs statfs ;
2895
2895
struct nfs4_acl * acl ;
2896
2896
u64 size ;
2897
+ #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2898
+ void * context ;
2899
+ int contextlen ;
2900
+ #endif
2897
2901
u32 rdattr_err ;
2898
2902
bool contextsupport ;
2899
2903
bool ignore_crossmnt ;
@@ -3334,6 +3338,15 @@ static __be32 nfsd4_encode_fattr4_suppattr_exclcreat(struct xdr_stream *xdr,
3334
3338
return nfsd4_encode_bitmap4 (xdr , supp [0 ], supp [1 ], supp [2 ]);
3335
3339
}
3336
3340
3341
+ #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3342
+ static __be32 nfsd4_encode_fattr4_sec_label (struct xdr_stream * xdr ,
3343
+ const struct nfsd4_fattr_args * args )
3344
+ {
3345
+ return nfsd4_encode_security_label (xdr , args -> rqstp ,
3346
+ args -> context , args -> contextlen );
3347
+ }
3348
+ #endif
3349
+
3337
3350
/*
3338
3351
* Note: @fhp can be NULL; in this case, we might have to compose the filehandle
3339
3352
* ourselves.
@@ -3354,10 +3367,6 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
3354
3367
int attrlen_offset ;
3355
3368
__be32 status ;
3356
3369
int err ;
3357
- #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3358
- void * context = NULL ;
3359
- int contextlen ;
3360
- #endif
3361
3370
struct nfsd4_compoundres * resp = rqstp -> rq_resp ;
3362
3371
u32 minorversion = resp -> cstate .minorversion ;
3363
3372
struct path path = {
@@ -3436,11 +3445,12 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
3436
3445
args .contextsupport = false;
3437
3446
3438
3447
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3448
+ args .context = NULL ;
3439
3449
if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL ) ||
3440
3450
bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS ) {
3441
3451
if (exp -> ex_flags & NFSEXP_SECURITY_LABEL )
3442
3452
err = security_inode_getsecctx (d_inode (dentry ),
3443
- & context , & contextlen );
3453
+ & args . context , & args . contextlen );
3444
3454
else
3445
3455
err = - EOPNOTSUPP ;
3446
3456
args .contextsupport = (err == 0 );
@@ -3719,8 +3729,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
3719
3729
3720
3730
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3721
3731
if (bmval2 & FATTR4_WORD2_SECURITY_LABEL ) {
3722
- status = nfsd4_encode_security_label (xdr , rqstp , context ,
3723
- contextlen );
3732
+ status = nfsd4_encode_fattr4_sec_label (xdr , & args );
3724
3733
if (status )
3725
3734
goto out ;
3726
3735
}
@@ -3739,8 +3748,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
3739
3748
3740
3749
out :
3741
3750
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3742
- if (context )
3743
- security_release_secctx (context , contextlen );
3751
+ if (args . context )
3752
+ security_release_secctx (args . context , args . contextlen );
3744
3753
#endif /* CONFIG_NFSD_V4_SECURITY_LABEL */
3745
3754
kfree (args .acl );
3746
3755
if (tempfh ) {
0 commit comments