Commit c228c24bf1138d4757dbe20615df655815446da3
Committed by
J. Bruce Fields
1 parent
24b8b44780
Exists in
master
and in
7 other branches
nfsd: fix compound state allocation error handling
Move the cstate_alloc call so that if it fails, the response is setup to encode the NFS error. The out label now means that the nfsd4_compound_state has not been allocated. Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Showing 1 changed file with 6 additions and 6 deletions Side-by-side Diff
fs/nfsd/nfs4proc.c
... | ... | @@ -867,11 +867,6 @@ |
867 | 867 | int slack_bytes; |
868 | 868 | __be32 status; |
869 | 869 | |
870 | - status = nfserr_resource; | |
871 | - cstate = cstate_alloc(); | |
872 | - if (cstate == NULL) | |
873 | - goto out; | |
874 | - | |
875 | 870 | resp->xbuf = &rqstp->rq_res; |
876 | 871 | resp->p = rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len; |
877 | 872 | resp->tagp = resp->p; |
... | ... | @@ -890,6 +885,11 @@ |
890 | 885 | if (args->minorversion > NFSD_SUPPORTED_MINOR_VERSION) |
891 | 886 | goto out; |
892 | 887 | |
888 | + status = nfserr_resource; | |
889 | + cstate = cstate_alloc(); | |
890 | + if (cstate == NULL) | |
891 | + goto out; | |
892 | + | |
893 | 893 | status = nfs_ok; |
894 | 894 | while (!status && resp->opcnt < args->opcnt) { |
895 | 895 | op = &args->ops[resp->opcnt++]; |
896 | 896 | |
... | ... | @@ -957,9 +957,9 @@ |
957 | 957 | nfsd4_increment_op_stats(op->opnum); |
958 | 958 | } |
959 | 959 | |
960 | + cstate_free(cstate); | |
960 | 961 | out: |
961 | 962 | nfsd4_release_compoundargs(args); |
962 | - cstate_free(cstate); | |
963 | 963 | dprintk("nfsv4 compound returned %d\n", ntohl(status)); |
964 | 964 | return status; |
965 | 965 | } |