diff options
author | Mi Jinlong <mijinlong@cn.fujitsu.com> | 2010-12-27 01:29:57 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-12-29 13:54:06 -0500 |
commit | 22b6dee842c6341b49bc09cc5728eb2f8f2b3766 (patch) | |
tree | 36c4a39433f2e99c385ab4eca11cfc8dcb99ca14 /fs/nfsd/nfs4xdr.c | |
parent | 04f4ad16b231abbfde34c762697ad035a3af0b5f (diff) |
nfsd4: fix oops on secinfo_no_name result encoding
The secinfo_no_name code oopses on encoding with
BUG: unable to handle kernel NULL pointer dereference at 00000044
IP: [<e2bd239a>] nfsd4_encode_secinfo+0x1c/0x1c1 [nfsd]
We should implement a nfsd4_encode_secinfo_no_name() instead using
nfsd4_encode_secinfo().
Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index b543b2410b54..437b4623cb02 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -2845,11 +2845,10 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_ | |||
2845 | } | 2845 | } |
2846 | 2846 | ||
2847 | static __be32 | 2847 | static __be32 |
2848 | nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, __be32 nfserr, | 2848 | nfsd4_do_encode_secinfo(struct nfsd4_compoundres *resp, |
2849 | struct nfsd4_secinfo *secinfo) | 2849 | __be32 nfserr,struct svc_export *exp) |
2850 | { | 2850 | { |
2851 | int i = 0; | 2851 | int i = 0; |
2852 | struct svc_export *exp = secinfo->si_exp; | ||
2853 | u32 nflavs; | 2852 | u32 nflavs; |
2854 | struct exp_flavor_info *flavs; | 2853 | struct exp_flavor_info *flavs; |
2855 | struct exp_flavor_info def_flavs[2]; | 2854 | struct exp_flavor_info def_flavs[2]; |
@@ -2911,6 +2910,20 @@ out: | |||
2911 | return nfserr; | 2910 | return nfserr; |
2912 | } | 2911 | } |
2913 | 2912 | ||
2913 | static __be32 | ||
2914 | nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, __be32 nfserr, | ||
2915 | struct nfsd4_secinfo *secinfo) | ||
2916 | { | ||
2917 | return nfsd4_do_encode_secinfo(resp, nfserr, secinfo->si_exp); | ||
2918 | } | ||
2919 | |||
2920 | static __be32 | ||
2921 | nfsd4_encode_secinfo_no_name(struct nfsd4_compoundres *resp, __be32 nfserr, | ||
2922 | struct nfsd4_secinfo_no_name *secinfo) | ||
2923 | { | ||
2924 | return nfsd4_do_encode_secinfo(resp, nfserr, secinfo->sin_exp); | ||
2925 | } | ||
2926 | |||
2914 | /* | 2927 | /* |
2915 | * The SETATTR encode routine is special -- it always encodes a bitmap, | 2928 | * The SETATTR encode routine is special -- it always encodes a bitmap, |
2916 | * regardless of the error status. | 2929 | * regardless of the error status. |
@@ -3173,7 +3186,7 @@ static nfsd4_enc nfsd4_enc_ops[] = { | |||
3173 | [OP_LAYOUTCOMMIT] = (nfsd4_enc)nfsd4_encode_noop, | 3186 | [OP_LAYOUTCOMMIT] = (nfsd4_enc)nfsd4_encode_noop, |
3174 | [OP_LAYOUTGET] = (nfsd4_enc)nfsd4_encode_noop, | 3187 | [OP_LAYOUTGET] = (nfsd4_enc)nfsd4_encode_noop, |
3175 | [OP_LAYOUTRETURN] = (nfsd4_enc)nfsd4_encode_noop, | 3188 | [OP_LAYOUTRETURN] = (nfsd4_enc)nfsd4_encode_noop, |
3176 | [OP_SECINFO_NO_NAME] = (nfsd4_enc)nfsd4_encode_secinfo, | 3189 | [OP_SECINFO_NO_NAME] = (nfsd4_enc)nfsd4_encode_secinfo_no_name, |
3177 | [OP_SEQUENCE] = (nfsd4_enc)nfsd4_encode_sequence, | 3190 | [OP_SEQUENCE] = (nfsd4_enc)nfsd4_encode_sequence, |
3178 | [OP_SET_SSV] = (nfsd4_enc)nfsd4_encode_noop, | 3191 | [OP_SET_SSV] = (nfsd4_enc)nfsd4_encode_noop, |
3179 | [OP_TEST_STATEID] = (nfsd4_enc)nfsd4_encode_noop, | 3192 | [OP_TEST_STATEID] = (nfsd4_enc)nfsd4_encode_noop, |