diff options
author | Christoph Hellwig <hch@lst.de> | 2017-05-12 10:11:49 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2017-05-15 11:42:31 -0400 |
commit | 860bda29b99afdc072a7a796fe81185f7ae85deb (patch) | |
tree | 801d2c90df6046bfec0b3be678d84acc2b5637e8 /fs/nfsd | |
parent | 7fd38af9cae6aef1dfd28a7d1bd214eb5ddb7d53 (diff) |
sunrpc: mark all struct svc_procinfo instances as const
struct svc_procinfo contains function pointers, and marking it as
constant avoids it being able to be used as an attach vector for
code injections.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs2acl.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs3acl.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs3proc.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs4proc.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsproc.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 4 |
6 files changed, 7 insertions, 7 deletions
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 026edfe73fd5..c3f6b8a6b659 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -370,7 +370,7 @@ struct nfsd3_voidargs { int dummy; }; | |||
370 | #define pAT (1+AT) /* post attributes - conditional */ | 370 | #define pAT (1+AT) /* post attributes - conditional */ |
371 | #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ | 371 | #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ |
372 | 372 | ||
373 | static struct svc_procedure nfsd_acl_procedures2[] = { | 373 | static const struct svc_procedure nfsd_acl_procedures2[] = { |
374 | PROC(null, void, void, void, RC_NOCACHE, ST), | 374 | PROC(null, void, void, void, RC_NOCACHE, ST), |
375 | PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), | 375 | PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), |
376 | PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT), | 376 | PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT), |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index 73c0970ccefb..1a482ac9d4e9 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -257,7 +257,7 @@ struct nfsd3_voidargs { int dummy; }; | |||
257 | #define pAT (1+AT) /* post attributes - conditional */ | 257 | #define pAT (1+AT) /* post attributes - conditional */ |
258 | #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ | 258 | #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ |
259 | 259 | ||
260 | static struct svc_procedure nfsd_acl_procedures3[] = { | 260 | static const struct svc_procedure nfsd_acl_procedures3[] = { |
261 | PROC(null, void, void, void, RC_NOCACHE, ST), | 261 | PROC(null, void, void, void, RC_NOCACHE, ST), |
262 | PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), | 262 | PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), |
263 | PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), | 263 | PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), |
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index b5823802e278..96e0e6a2af51 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c | |||
@@ -674,7 +674,7 @@ struct nfsd3_voidargs { int dummy; }; | |||
674 | #define pAT (1+AT) /* post attributes - conditional */ | 674 | #define pAT (1+AT) /* post attributes - conditional */ |
675 | #define WC (7+pAT) /* WCC attributes */ | 675 | #define WC (7+pAT) /* WCC attributes */ |
676 | 676 | ||
677 | static struct svc_procedure nfsd_procedures3[22] = { | 677 | static const struct svc_procedure nfsd_procedures3[22] = { |
678 | [NFS3PROC_NULL] = { | 678 | [NFS3PROC_NULL] = { |
679 | .pc_func = nfsd3_proc_null, | 679 | .pc_func = nfsd3_proc_null, |
680 | .pc_encode = nfs3svc_encode_voidres, | 680 | .pc_encode = nfs3svc_encode_voidres, |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index bad5fec0ebc7..a4d8aa3abc63 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -2533,7 +2533,7 @@ static const char *nfsd4_op_name(unsigned opnum) | |||
2533 | #define nfsd4_voidres nfsd4_voidargs | 2533 | #define nfsd4_voidres nfsd4_voidargs |
2534 | struct nfsd4_voidargs { int dummy; }; | 2534 | struct nfsd4_voidargs { int dummy; }; |
2535 | 2535 | ||
2536 | static struct svc_procedure nfsd_procedures4[2] = { | 2536 | static const struct svc_procedure nfsd_procedures4[2] = { |
2537 | [NFSPROC4_NULL] = { | 2537 | [NFSPROC4_NULL] = { |
2538 | .pc_func = nfsd4_proc_null, | 2538 | .pc_func = nfsd4_proc_null, |
2539 | .pc_encode = nfs4svc_encode_voidres, | 2539 | .pc_encode = nfs4svc_encode_voidres, |
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 44b157553733..a68b686fda12 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -573,7 +573,7 @@ struct nfsd_void { int dummy; }; | |||
573 | #define FH 8 /* filehandle */ | 573 | #define FH 8 /* filehandle */ |
574 | #define AT 18 /* attributes */ | 574 | #define AT 18 /* attributes */ |
575 | 575 | ||
576 | static struct svc_procedure nfsd_procedures2[18] = { | 576 | static const struct svc_procedure nfsd_procedures2[18] = { |
577 | [NFSPROC_NULL] = { | 577 | [NFSPROC_NULL] = { |
578 | .pc_func = nfsd_proc_null, | 578 | .pc_func = nfsd_proc_null, |
579 | .pc_decode = nfssvc_decode_void, | 579 | .pc_decode = nfssvc_decode_void, |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 555233664124..379b310c445d 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -756,7 +756,7 @@ static __be32 map_new_errors(u32 vers, __be32 nfserr) | |||
756 | * problem, we enforce these assumptions here: | 756 | * problem, we enforce these assumptions here: |
757 | */ | 757 | */ |
758 | static bool nfs_request_too_big(struct svc_rqst *rqstp, | 758 | static bool nfs_request_too_big(struct svc_rqst *rqstp, |
759 | struct svc_procedure *proc) | 759 | const struct svc_procedure *proc) |
760 | { | 760 | { |
761 | /* | 761 | /* |
762 | * The ACL code has more careful bounds-checking and is not | 762 | * The ACL code has more careful bounds-checking and is not |
@@ -781,7 +781,7 @@ static bool nfs_request_too_big(struct svc_rqst *rqstp, | |||
781 | int | 781 | int |
782 | nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) | 782 | nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) |
783 | { | 783 | { |
784 | struct svc_procedure *proc; | 784 | const struct svc_procedure *proc; |
785 | __be32 nfserr; | 785 | __be32 nfserr; |
786 | __be32 *nfserrp; | 786 | __be32 *nfserrp; |
787 | 787 | ||