summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2017-08-01 11:59:58 -0400
committerJ. Bruce Fields <bfields@redhat.com>2017-08-24 22:13:50 -0400
commitc1df609d9dcec5dcb89ee3091edc3671da1c9996 (patch)
treeb4c7ea7ca342e71533893e218910664324e8dc75 /fs/nfsd
parent2412e927604e0af7e17ae4b688b85a1e87e378fe (diff)
nfsd: Const-ify NFSv4 encoding and decoding ops arrays
Close an attack vector by moving the arrays of encoding and decoding methods to read-only memory. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4xdr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 18b9c2fad29a..0c3b935d100f 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1780,7 +1780,7 @@ nfsd4_decode_notsupp(struct nfsd4_compoundargs *argp, void *p)
1780 1780
1781typedef __be32(*nfsd4_dec)(struct nfsd4_compoundargs *argp, void *); 1781typedef __be32(*nfsd4_dec)(struct nfsd4_compoundargs *argp, void *);
1782 1782
1783static nfsd4_dec nfsd4_dec_ops[] = { 1783static const nfsd4_dec nfsd4_dec_ops[] = {
1784 [OP_ACCESS] = (nfsd4_dec)nfsd4_decode_access, 1784 [OP_ACCESS] = (nfsd4_dec)nfsd4_decode_access,
1785 [OP_CLOSE] = (nfsd4_dec)nfsd4_decode_close, 1785 [OP_CLOSE] = (nfsd4_dec)nfsd4_decode_close,
1786 [OP_COMMIT] = (nfsd4_dec)nfsd4_decode_commit, 1786 [OP_COMMIT] = (nfsd4_dec)nfsd4_decode_commit,
@@ -4224,7 +4224,7 @@ typedef __be32(* nfsd4_enc)(struct nfsd4_compoundres *, __be32, void *);
4224 * since we don't need to filter out obsolete ops as this is 4224 * since we don't need to filter out obsolete ops as this is
4225 * done in the decoding phase. 4225 * done in the decoding phase.
4226 */ 4226 */
4227static nfsd4_enc nfsd4_enc_ops[] = { 4227static const nfsd4_enc nfsd4_enc_ops[] = {
4228 [OP_ACCESS] = (nfsd4_enc)nfsd4_encode_access, 4228 [OP_ACCESS] = (nfsd4_enc)nfsd4_encode_access,
4229 [OP_CLOSE] = (nfsd4_enc)nfsd4_encode_close, 4229 [OP_CLOSE] = (nfsd4_enc)nfsd4_encode_close,
4230 [OP_COMMIT] = (nfsd4_enc)nfsd4_encode_commit, 4230 [OP_COMMIT] = (nfsd4_enc)nfsd4_encode_commit,