diff options
| -rw-r--r-- | fs/nfsd/nfs4xdr.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 09204f590355..250171c5c311 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -65,17 +65,17 @@ | |||
| 65 | #define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL | 65 | #define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL |
| 66 | 66 | ||
| 67 | static __be32 | 67 | static __be32 |
| 68 | check_filename(char *str, int len, __be32 err) | 68 | check_filename(char *str, int len) |
| 69 | { | 69 | { |
| 70 | int i; | 70 | int i; |
| 71 | 71 | ||
| 72 | if (len == 0) | 72 | if (len == 0) |
| 73 | return nfserr_inval; | 73 | return nfserr_inval; |
| 74 | if (isdotent(str, len)) | 74 | if (isdotent(str, len)) |
| 75 | return err; | 75 | return nfserr_badname; |
| 76 | for (i = 0; i < len; i++) | 76 | for (i = 0; i < len; i++) |
| 77 | if (str[i] == '/') | 77 | if (str[i] == '/') |
| 78 | return err; | 78 | return nfserr_badname; |
| 79 | return 0; | 79 | return 0; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -570,7 +570,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
| 570 | READ32(create->cr_namelen); | 570 | READ32(create->cr_namelen); |
| 571 | READ_BUF(create->cr_namelen); | 571 | READ_BUF(create->cr_namelen); |
| 572 | SAVEMEM(create->cr_name, create->cr_namelen); | 572 | SAVEMEM(create->cr_name, create->cr_namelen); |
| 573 | if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval))) | 573 | if ((status = check_filename(create->cr_name, create->cr_namelen))) |
| 574 | return status; | 574 | return status; |
| 575 | 575 | ||
| 576 | status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, | 576 | status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, |
| @@ -602,7 +602,7 @@ nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) | |||
| 602 | READ32(link->li_namelen); | 602 | READ32(link->li_namelen); |
| 603 | READ_BUF(link->li_namelen); | 603 | READ_BUF(link->li_namelen); |
| 604 | SAVEMEM(link->li_name, link->li_namelen); | 604 | SAVEMEM(link->li_name, link->li_namelen); |
| 605 | if ((status = check_filename(link->li_name, link->li_namelen, nfserr_inval))) | 605 | if ((status = check_filename(link->li_name, link->li_namelen))) |
| 606 | return status; | 606 | return status; |
| 607 | 607 | ||
| 608 | DECODE_TAIL; | 608 | DECODE_TAIL; |
| @@ -696,7 +696,7 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup | |||
| 696 | READ32(lookup->lo_len); | 696 | READ32(lookup->lo_len); |
| 697 | READ_BUF(lookup->lo_len); | 697 | READ_BUF(lookup->lo_len); |
| 698 | SAVEMEM(lookup->lo_name, lookup->lo_len); | 698 | SAVEMEM(lookup->lo_name, lookup->lo_len); |
| 699 | if ((status = check_filename(lookup->lo_name, lookup->lo_len, nfserr_noent))) | 699 | if ((status = check_filename(lookup->lo_name, lookup->lo_len))) |
| 700 | return status; | 700 | return status; |
| 701 | 701 | ||
| 702 | DECODE_TAIL; | 702 | DECODE_TAIL; |
| @@ -860,7 +860,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | |||
| 860 | READ32(open->op_fname.len); | 860 | READ32(open->op_fname.len); |
| 861 | READ_BUF(open->op_fname.len); | 861 | READ_BUF(open->op_fname.len); |
| 862 | SAVEMEM(open->op_fname.data, open->op_fname.len); | 862 | SAVEMEM(open->op_fname.data, open->op_fname.len); |
| 863 | if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) | 863 | if ((status = check_filename(open->op_fname.data, open->op_fname.len))) |
| 864 | return status; | 864 | return status; |
| 865 | break; | 865 | break; |
| 866 | case NFS4_OPEN_CLAIM_PREVIOUS: | 866 | case NFS4_OPEN_CLAIM_PREVIOUS: |
| @@ -875,7 +875,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | |||
| 875 | READ32(open->op_fname.len); | 875 | READ32(open->op_fname.len); |
| 876 | READ_BUF(open->op_fname.len); | 876 | READ_BUF(open->op_fname.len); |
| 877 | SAVEMEM(open->op_fname.data, open->op_fname.len); | 877 | SAVEMEM(open->op_fname.data, open->op_fname.len); |
| 878 | if ((status = check_filename(open->op_fname.data, open->op_fname.len, nfserr_inval))) | 878 | if ((status = check_filename(open->op_fname.data, open->op_fname.len))) |
| 879 | return status; | 879 | return status; |
| 880 | break; | 880 | break; |
| 881 | case NFS4_OPEN_CLAIM_FH: | 881 | case NFS4_OPEN_CLAIM_FH: |
| @@ -987,7 +987,7 @@ nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove | |||
| 987 | READ32(remove->rm_namelen); | 987 | READ32(remove->rm_namelen); |
| 988 | READ_BUF(remove->rm_namelen); | 988 | READ_BUF(remove->rm_namelen); |
| 989 | SAVEMEM(remove->rm_name, remove->rm_namelen); | 989 | SAVEMEM(remove->rm_name, remove->rm_namelen); |
| 990 | if ((status = check_filename(remove->rm_name, remove->rm_namelen, nfserr_noent))) | 990 | if ((status = check_filename(remove->rm_name, remove->rm_namelen))) |
| 991 | return status; | 991 | return status; |
| 992 | 992 | ||
| 993 | DECODE_TAIL; | 993 | DECODE_TAIL; |
| @@ -1005,9 +1005,9 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename | |||
| 1005 | READ32(rename->rn_tnamelen); | 1005 | READ32(rename->rn_tnamelen); |
| 1006 | READ_BUF(rename->rn_tnamelen); | 1006 | READ_BUF(rename->rn_tnamelen); |
| 1007 | SAVEMEM(rename->rn_tname, rename->rn_tnamelen); | 1007 | SAVEMEM(rename->rn_tname, rename->rn_tnamelen); |
| 1008 | if ((status = check_filename(rename->rn_sname, rename->rn_snamelen, nfserr_noent))) | 1008 | if ((status = check_filename(rename->rn_sname, rename->rn_snamelen))) |
| 1009 | return status; | 1009 | return status; |
| 1010 | if ((status = check_filename(rename->rn_tname, rename->rn_tnamelen, nfserr_inval))) | 1010 | if ((status = check_filename(rename->rn_tname, rename->rn_tnamelen))) |
| 1011 | return status; | 1011 | return status; |
| 1012 | 1012 | ||
| 1013 | DECODE_TAIL; | 1013 | DECODE_TAIL; |
| @@ -1034,8 +1034,7 @@ nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp, | |||
| 1034 | READ32(secinfo->si_namelen); | 1034 | READ32(secinfo->si_namelen); |
| 1035 | READ_BUF(secinfo->si_namelen); | 1035 | READ_BUF(secinfo->si_namelen); |
| 1036 | SAVEMEM(secinfo->si_name, secinfo->si_namelen); | 1036 | SAVEMEM(secinfo->si_name, secinfo->si_namelen); |
| 1037 | status = check_filename(secinfo->si_name, secinfo->si_namelen, | 1037 | status = check_filename(secinfo->si_name, secinfo->si_namelen); |
| 1038 | nfserr_noent); | ||
| 1039 | if (status) | 1038 | if (status) |
| 1040 | return status; | 1039 | return status; |
| 1041 | DECODE_TAIL; | 1040 | DECODE_TAIL; |
