aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c162
1 files changed, 84 insertions, 78 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 6600aa2d2ef3..8b7794c31591 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -821,8 +821,8 @@ PsxDelete:
821 821
822 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 822 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
823 name_len = 823 name_len =
824 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 824 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
825 PATH_MAX, nls_codepage, remap); 825 PATH_MAX, nls_codepage, remap);
826 name_len++; /* trailing null */ 826 name_len++; /* trailing null */
827 name_len *= 2; 827 name_len *= 2;
828 } else { /* BB add path length overrun check */ 828 } else { /* BB add path length overrun check */
@@ -893,8 +893,8 @@ DelFileRetry:
893 893
894 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 894 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
895 name_len = 895 name_len =
896 cifsConvertToUCS((__le16 *) pSMB->fileName, fileName, 896 cifsConvertToUTF16((__le16 *) pSMB->fileName, fileName,
897 PATH_MAX, nls_codepage, remap); 897 PATH_MAX, nls_codepage, remap);
898 name_len++; /* trailing null */ 898 name_len++; /* trailing null */
899 name_len *= 2; 899 name_len *= 2;
900 } else { /* BB improve check for buffer overruns BB */ 900 } else { /* BB improve check for buffer overruns BB */
@@ -938,8 +938,8 @@ RmDirRetry:
938 return rc; 938 return rc;
939 939
940 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 940 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
941 name_len = cifsConvertToUCS((__le16 *) pSMB->DirName, dirName, 941 name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, dirName,
942 PATH_MAX, nls_codepage, remap); 942 PATH_MAX, nls_codepage, remap);
943 name_len++; /* trailing null */ 943 name_len++; /* trailing null */
944 name_len *= 2; 944 name_len *= 2;
945 } else { /* BB improve check for buffer overruns BB */ 945 } else { /* BB improve check for buffer overruns BB */
@@ -981,8 +981,8 @@ MkDirRetry:
981 return rc; 981 return rc;
982 982
983 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 983 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
984 name_len = cifsConvertToUCS((__le16 *) pSMB->DirName, name, 984 name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, name,
985 PATH_MAX, nls_codepage, remap); 985 PATH_MAX, nls_codepage, remap);
986 name_len++; /* trailing null */ 986 name_len++; /* trailing null */
987 name_len *= 2; 987 name_len *= 2;
988 } else { /* BB improve check for buffer overruns BB */ 988 } else { /* BB improve check for buffer overruns BB */
@@ -1030,8 +1030,8 @@ PsxCreat:
1030 1030
1031 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1031 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1032 name_len = 1032 name_len =
1033 cifsConvertToUCS((__le16 *) pSMB->FileName, name, 1033 cifsConvertToUTF16((__le16 *) pSMB->FileName, name,
1034 PATH_MAX, nls_codepage, remap); 1034 PATH_MAX, nls_codepage, remap);
1035 name_len++; /* trailing null */ 1035 name_len++; /* trailing null */
1036 name_len *= 2; 1036 name_len *= 2;
1037 } else { /* BB improve the check for buffer overruns BB */ 1037 } else { /* BB improve the check for buffer overruns BB */
@@ -1197,8 +1197,8 @@ OldOpenRetry:
1197 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1197 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1198 count = 1; /* account for one byte pad to word boundary */ 1198 count = 1; /* account for one byte pad to word boundary */
1199 name_len = 1199 name_len =
1200 cifsConvertToUCS((__le16 *) (pSMB->fileName + 1), 1200 cifsConvertToUTF16((__le16 *) (pSMB->fileName + 1),
1201 fileName, PATH_MAX, nls_codepage, remap); 1201 fileName, PATH_MAX, nls_codepage, remap);
1202 name_len++; /* trailing null */ 1202 name_len++; /* trailing null */
1203 name_len *= 2; 1203 name_len *= 2;
1204 } else { /* BB improve check for buffer overruns BB */ 1204 } else { /* BB improve check for buffer overruns BB */
@@ -1304,8 +1304,8 @@ openRetry:
1304 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1304 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1305 count = 1; /* account for one byte pad to word boundary */ 1305 count = 1; /* account for one byte pad to word boundary */
1306 name_len = 1306 name_len =
1307 cifsConvertToUCS((__le16 *) (pSMB->fileName + 1), 1307 cifsConvertToUTF16((__le16 *) (pSMB->fileName + 1),
1308 fileName, PATH_MAX, nls_codepage, remap); 1308 fileName, PATH_MAX, nls_codepage, remap);
1309 name_len++; /* trailing null */ 1309 name_len++; /* trailing null */
1310 name_len *= 2; 1310 name_len *= 2;
1311 pSMB->NameLength = cpu_to_le16(name_len); 1311 pSMB->NameLength = cpu_to_le16(name_len);
@@ -2649,16 +2649,16 @@ renameRetry:
2649 2649
2650 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2650 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2651 name_len = 2651 name_len =
2652 cifsConvertToUCS((__le16 *) pSMB->OldFileName, fromName, 2652 cifsConvertToUTF16((__le16 *) pSMB->OldFileName, fromName,
2653 PATH_MAX, nls_codepage, remap); 2653 PATH_MAX, nls_codepage, remap);
2654 name_len++; /* trailing null */ 2654 name_len++; /* trailing null */
2655 name_len *= 2; 2655 name_len *= 2;
2656 pSMB->OldFileName[name_len] = 0x04; /* pad */ 2656 pSMB->OldFileName[name_len] = 0x04; /* pad */
2657 /* protocol requires ASCII signature byte on Unicode string */ 2657 /* protocol requires ASCII signature byte on Unicode string */
2658 pSMB->OldFileName[name_len + 1] = 0x00; 2658 pSMB->OldFileName[name_len + 1] = 0x00;
2659 name_len2 = 2659 name_len2 =
2660 cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2], 2660 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2661 toName, PATH_MAX, nls_codepage, remap); 2661 toName, PATH_MAX, nls_codepage, remap);
2662 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 2662 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
2663 name_len2 *= 2; /* convert to bytes */ 2663 name_len2 *= 2; /* convert to bytes */
2664 } else { /* BB improve the check for buffer overruns BB */ 2664 } else { /* BB improve the check for buffer overruns BB */
@@ -2738,10 +2738,12 @@ int CIFSSMBRenameOpenFile(const int xid, struct cifs_tcon *pTcon,
2738 /* unicode only call */ 2738 /* unicode only call */
2739 if (target_name == NULL) { 2739 if (target_name == NULL) {
2740 sprintf(dummy_string, "cifs%x", pSMB->hdr.Mid); 2740 sprintf(dummy_string, "cifs%x", pSMB->hdr.Mid);
2741 len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name, 2741 len_of_str =
2742 cifsConvertToUTF16((__le16 *)rename_info->target_name,
2742 dummy_string, 24, nls_codepage, remap); 2743 dummy_string, 24, nls_codepage, remap);
2743 } else { 2744 } else {
2744 len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name, 2745 len_of_str =
2746 cifsConvertToUTF16((__le16 *)rename_info->target_name,
2745 target_name, PATH_MAX, nls_codepage, 2747 target_name, PATH_MAX, nls_codepage,
2746 remap); 2748 remap);
2747 } 2749 }
@@ -2795,17 +2797,17 @@ copyRetry:
2795 pSMB->Flags = cpu_to_le16(flags & COPY_TREE); 2797 pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
2796 2798
2797 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2799 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2798 name_len = cifsConvertToUCS((__le16 *) pSMB->OldFileName, 2800 name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
2799 fromName, PATH_MAX, nls_codepage, 2801 fromName, PATH_MAX, nls_codepage,
2800 remap); 2802 remap);
2801 name_len++; /* trailing null */ 2803 name_len++; /* trailing null */
2802 name_len *= 2; 2804 name_len *= 2;
2803 pSMB->OldFileName[name_len] = 0x04; /* pad */ 2805 pSMB->OldFileName[name_len] = 0x04; /* pad */
2804 /* protocol requires ASCII signature byte on Unicode string */ 2806 /* protocol requires ASCII signature byte on Unicode string */
2805 pSMB->OldFileName[name_len + 1] = 0x00; 2807 pSMB->OldFileName[name_len + 1] = 0x00;
2806 name_len2 = 2808 name_len2 =
2807 cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2], 2809 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2808 toName, PATH_MAX, nls_codepage, remap); 2810 toName, PATH_MAX, nls_codepage, remap);
2809 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 2811 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
2810 name_len2 *= 2; /* convert to bytes */ 2812 name_len2 *= 2; /* convert to bytes */
2811 } else { /* BB improve the check for buffer overruns BB */ 2813 } else { /* BB improve the check for buffer overruns BB */
@@ -2861,9 +2863,9 @@ createSymLinkRetry:
2861 2863
2862 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2864 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2863 name_len = 2865 name_len =
2864 cifs_strtoUCS((__le16 *) pSMB->FileName, fromName, PATH_MAX 2866 cifs_strtoUTF16((__le16 *) pSMB->FileName, fromName,
2865 /* find define for this maxpathcomponent */ 2867 /* find define for this maxpathcomponent */
2866 , nls_codepage); 2868 PATH_MAX, nls_codepage);
2867 name_len++; /* trailing null */ 2869 name_len++; /* trailing null */
2868 name_len *= 2; 2870 name_len *= 2;
2869 2871
@@ -2885,9 +2887,9 @@ createSymLinkRetry:
2885 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 2887 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
2886 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2888 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2887 name_len_target = 2889 name_len_target =
2888 cifs_strtoUCS((__le16 *) data_offset, toName, PATH_MAX 2890 cifs_strtoUTF16((__le16 *) data_offset, toName, PATH_MAX
2889 /* find define for this maxpathcomponent */ 2891 /* find define for this maxpathcomponent */
2890 , nls_codepage); 2892 , nls_codepage);
2891 name_len_target++; /* trailing null */ 2893 name_len_target++; /* trailing null */
2892 name_len_target *= 2; 2894 name_len_target *= 2;
2893 } else { /* BB improve the check for buffer overruns BB */ 2895 } else { /* BB improve the check for buffer overruns BB */
@@ -2949,8 +2951,8 @@ createHardLinkRetry:
2949 return rc; 2951 return rc;
2950 2952
2951 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2953 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2952 name_len = cifsConvertToUCS((__le16 *) pSMB->FileName, toName, 2954 name_len = cifsConvertToUTF16((__le16 *) pSMB->FileName, toName,
2953 PATH_MAX, nls_codepage, remap); 2955 PATH_MAX, nls_codepage, remap);
2954 name_len++; /* trailing null */ 2956 name_len++; /* trailing null */
2955 name_len *= 2; 2957 name_len *= 2;
2956 2958
@@ -2972,8 +2974,8 @@ createHardLinkRetry:
2972 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 2974 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
2973 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2975 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2974 name_len_target = 2976 name_len_target =
2975 cifsConvertToUCS((__le16 *) data_offset, fromName, PATH_MAX, 2977 cifsConvertToUTF16((__le16 *) data_offset, fromName,
2976 nls_codepage, remap); 2978 PATH_MAX, nls_codepage, remap);
2977 name_len_target++; /* trailing null */ 2979 name_len_target++; /* trailing null */
2978 name_len_target *= 2; 2980 name_len_target *= 2;
2979 } else { /* BB improve the check for buffer overruns BB */ 2981 } else { /* BB improve the check for buffer overruns BB */
@@ -3042,8 +3044,8 @@ winCreateHardLinkRetry:
3042 3044
3043 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3045 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3044 name_len = 3046 name_len =
3045 cifsConvertToUCS((__le16 *) pSMB->OldFileName, fromName, 3047 cifsConvertToUTF16((__le16 *) pSMB->OldFileName, fromName,
3046 PATH_MAX, nls_codepage, remap); 3048 PATH_MAX, nls_codepage, remap);
3047 name_len++; /* trailing null */ 3049 name_len++; /* trailing null */
3048 name_len *= 2; 3050 name_len *= 2;
3049 3051
@@ -3051,8 +3053,8 @@ winCreateHardLinkRetry:
3051 pSMB->OldFileName[name_len] = 0x04; 3053 pSMB->OldFileName[name_len] = 0x04;
3052 pSMB->OldFileName[name_len + 1] = 0x00; /* pad */ 3054 pSMB->OldFileName[name_len + 1] = 0x00; /* pad */
3053 name_len2 = 3055 name_len2 =
3054 cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2], 3056 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
3055 toName, PATH_MAX, nls_codepage, remap); 3057 toName, PATH_MAX, nls_codepage, remap);
3056 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 3058 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
3057 name_len2 *= 2; /* convert to bytes */ 3059 name_len2 *= 2; /* convert to bytes */
3058 } else { /* BB improve the check for buffer overruns BB */ 3060 } else { /* BB improve the check for buffer overruns BB */
@@ -3108,8 +3110,8 @@ querySymLinkRetry:
3108 3110
3109 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3111 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3110 name_len = 3112 name_len =
3111 cifs_strtoUCS((__le16 *) pSMB->FileName, searchName, 3113 cifs_strtoUTF16((__le16 *) pSMB->FileName, searchName,
3112 PATH_MAX, nls_codepage); 3114 PATH_MAX, nls_codepage);
3113 name_len++; /* trailing null */ 3115 name_len++; /* trailing null */
3114 name_len *= 2; 3116 name_len *= 2;
3115 } else { /* BB improve the check for buffer overruns BB */ 3117 } else { /* BB improve the check for buffer overruns BB */
@@ -3166,8 +3168,8 @@ querySymLinkRetry:
3166 is_unicode = false; 3168 is_unicode = false;
3167 3169
3168 /* BB FIXME investigate remapping reserved chars here */ 3170 /* BB FIXME investigate remapping reserved chars here */
3169 *symlinkinfo = cifs_strndup_from_ucs(data_start, count, 3171 *symlinkinfo = cifs_strndup_from_utf16(data_start,
3170 is_unicode, nls_codepage); 3172 count, is_unicode, nls_codepage);
3171 if (!*symlinkinfo) 3173 if (!*symlinkinfo)
3172 rc = -ENOMEM; 3174 rc = -ENOMEM;
3173 } 3175 }
@@ -3450,8 +3452,9 @@ queryAclRetry:
3450 3452
3451 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3453 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3452 name_len = 3454 name_len =
3453 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 3455 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3454 PATH_MAX, nls_codepage, remap); 3456 searchName, PATH_MAX, nls_codepage,
3457 remap);
3455 name_len++; /* trailing null */ 3458 name_len++; /* trailing null */
3456 name_len *= 2; 3459 name_len *= 2;
3457 pSMB->FileName[name_len] = 0; 3460 pSMB->FileName[name_len] = 0;
@@ -3537,8 +3540,8 @@ setAclRetry:
3537 return rc; 3540 return rc;
3538 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3541 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3539 name_len = 3542 name_len =
3540 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 3543 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
3541 PATH_MAX, nls_codepage, remap); 3544 PATH_MAX, nls_codepage, remap);
3542 name_len++; /* trailing null */ 3545 name_len++; /* trailing null */
3543 name_len *= 2; 3546 name_len *= 2;
3544 } else { /* BB improve the check for buffer overruns BB */ 3547 } else { /* BB improve the check for buffer overruns BB */
@@ -3948,8 +3951,9 @@ QInfRetry:
3948 3951
3949 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3952 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3950 name_len = 3953 name_len =
3951 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 3954 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3952 PATH_MAX, nls_codepage, remap); 3955 searchName, PATH_MAX, nls_codepage,
3956 remap);
3953 name_len++; /* trailing null */ 3957 name_len++; /* trailing null */
3954 name_len *= 2; 3958 name_len *= 2;
3955 } else { 3959 } else {
@@ -4086,8 +4090,8 @@ QPathInfoRetry:
4086 4090
4087 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4091 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4088 name_len = 4092 name_len =
4089 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 4093 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
4090 PATH_MAX, nls_codepage, remap); 4094 PATH_MAX, nls_codepage, remap);
4091 name_len++; /* trailing null */ 4095 name_len++; /* trailing null */
4092 name_len *= 2; 4096 name_len *= 2;
4093 } else { /* BB improve the check for buffer overruns BB */ 4097 } else { /* BB improve the check for buffer overruns BB */
@@ -4255,8 +4259,8 @@ UnixQPathInfoRetry:
4255 4259
4256 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4260 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4257 name_len = 4261 name_len =
4258 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 4262 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
4259 PATH_MAX, nls_codepage, remap); 4263 PATH_MAX, nls_codepage, remap);
4260 name_len++; /* trailing null */ 4264 name_len++; /* trailing null */
4261 name_len *= 2; 4265 name_len *= 2;
4262 } else { /* BB improve the check for buffer overruns BB */ 4266 } else { /* BB improve the check for buffer overruns BB */
@@ -4344,8 +4348,8 @@ findFirstRetry:
4344 4348
4345 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4349 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4346 name_len = 4350 name_len =
4347 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 4351 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
4348 PATH_MAX, nls_codepage, remap); 4352 PATH_MAX, nls_codepage, remap);
4349 /* We can not add the asterik earlier in case 4353 /* We can not add the asterik earlier in case
4350 it got remapped to 0xF03A as if it were part of the 4354 it got remapped to 0xF03A as if it were part of the
4351 directory name instead of a wildcard */ 4355 directory name instead of a wildcard */
@@ -4656,8 +4660,9 @@ GetInodeNumberRetry:
4656 4660
4657 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4661 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4658 name_len = 4662 name_len =
4659 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 4663 cifsConvertToUTF16((__le16 *) pSMB->FileName,
4660 PATH_MAX, nls_codepage, remap); 4664 searchName, PATH_MAX, nls_codepage,
4665 remap);
4661 name_len++; /* trailing null */ 4666 name_len++; /* trailing null */
4662 name_len *= 2; 4667 name_len *= 2;
4663 } else { /* BB improve the check for buffer overruns BB */ 4668 } else { /* BB improve the check for buffer overruns BB */
@@ -4794,9 +4799,9 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
4794 rc = -ENOMEM; 4799 rc = -ENOMEM;
4795 goto parse_DFS_referrals_exit; 4800 goto parse_DFS_referrals_exit;
4796 } 4801 }
4797 cifsConvertToUCS((__le16 *) tmp, searchName, 4802 cifsConvertToUTF16((__le16 *) tmp, searchName,
4798 PATH_MAX, nls_codepage, remap); 4803 PATH_MAX, nls_codepage, remap);
4799 node->path_consumed = cifs_ucs2_bytes(tmp, 4804 node->path_consumed = cifs_utf16_bytes(tmp,
4800 le16_to_cpu(pSMBr->PathConsumed), 4805 le16_to_cpu(pSMBr->PathConsumed),
4801 nls_codepage); 4806 nls_codepage);
4802 kfree(tmp); 4807 kfree(tmp);
@@ -4809,8 +4814,8 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
4809 /* copy DfsPath */ 4814 /* copy DfsPath */
4810 temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset); 4815 temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset);
4811 max_len = data_end - temp; 4816 max_len = data_end - temp;
4812 node->path_name = cifs_strndup_from_ucs(temp, max_len, 4817 node->path_name = cifs_strndup_from_utf16(temp, max_len,
4813 is_unicode, nls_codepage); 4818 is_unicode, nls_codepage);
4814 if (!node->path_name) { 4819 if (!node->path_name) {
4815 rc = -ENOMEM; 4820 rc = -ENOMEM;
4816 goto parse_DFS_referrals_exit; 4821 goto parse_DFS_referrals_exit;
@@ -4819,8 +4824,8 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
4819 /* copy link target UNC */ 4824 /* copy link target UNC */
4820 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset); 4825 temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset);
4821 max_len = data_end - temp; 4826 max_len = data_end - temp;
4822 node->node_name = cifs_strndup_from_ucs(temp, max_len, 4827 node->node_name = cifs_strndup_from_utf16(temp, max_len,
4823 is_unicode, nls_codepage); 4828 is_unicode, nls_codepage);
4824 if (!node->node_name) 4829 if (!node->node_name)
4825 rc = -ENOMEM; 4830 rc = -ENOMEM;
4826 } 4831 }
@@ -4873,8 +4878,9 @@ getDFSRetry:
4873 if (ses->capabilities & CAP_UNICODE) { 4878 if (ses->capabilities & CAP_UNICODE) {
4874 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; 4879 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
4875 name_len = 4880 name_len =
4876 cifsConvertToUCS((__le16 *) pSMB->RequestFileName, 4881 cifsConvertToUTF16((__le16 *) pSMB->RequestFileName,
4877 searchName, PATH_MAX, nls_codepage, remap); 4882 searchName, PATH_MAX, nls_codepage,
4883 remap);
4878 name_len++; /* trailing null */ 4884 name_len++; /* trailing null */
4879 name_len *= 2; 4885 name_len *= 2;
4880 } else { /* BB improve the check for buffer overruns BB */ 4886 } else { /* BB improve the check for buffer overruns BB */
@@ -5506,8 +5512,8 @@ SetEOFRetry:
5506 5512
5507 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 5513 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5508 name_len = 5514 name_len =
5509 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 5515 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
5510 PATH_MAX, nls_codepage, remap); 5516 PATH_MAX, nls_codepage, remap);
5511 name_len++; /* trailing null */ 5517 name_len++; /* trailing null */
5512 name_len *= 2; 5518 name_len *= 2;
5513 } else { /* BB improve the check for buffer overruns BB */ 5519 } else { /* BB improve the check for buffer overruns BB */
@@ -5796,8 +5802,8 @@ SetTimesRetry:
5796 5802
5797 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 5803 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5798 name_len = 5804 name_len =
5799 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 5805 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
5800 PATH_MAX, nls_codepage, remap); 5806 PATH_MAX, nls_codepage, remap);
5801 name_len++; /* trailing null */ 5807 name_len++; /* trailing null */
5802 name_len *= 2; 5808 name_len *= 2;
5803 } else { /* BB improve the check for buffer overruns BB */ 5809 } else { /* BB improve the check for buffer overruns BB */
@@ -5877,8 +5883,8 @@ SetAttrLgcyRetry:
5877 5883
5878 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 5884 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5879 name_len = 5885 name_len =
5880 ConvertToUCS((__le16 *) pSMB->fileName, fileName, 5886 ConvertToUTF16((__le16 *) pSMB->fileName, fileName,
5881 PATH_MAX, nls_codepage); 5887 PATH_MAX, nls_codepage);
5882 name_len++; /* trailing null */ 5888 name_len++; /* trailing null */
5883 name_len *= 2; 5889 name_len *= 2;
5884 } else { /* BB improve the check for buffer overruns BB */ 5890 } else { /* BB improve the check for buffer overruns BB */
@@ -6030,8 +6036,8 @@ setPermsRetry:
6030 6036
6031 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 6037 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
6032 name_len = 6038 name_len =
6033 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 6039 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
6034 PATH_MAX, nls_codepage, remap); 6040 PATH_MAX, nls_codepage, remap);
6035 name_len++; /* trailing null */ 6041 name_len++; /* trailing null */
6036 name_len *= 2; 6042 name_len *= 2;
6037 } else { /* BB improve the check for buffer overruns BB */ 6043 } else { /* BB improve the check for buffer overruns BB */
@@ -6123,8 +6129,8 @@ QAllEAsRetry:
6123 6129
6124 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 6130 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
6125 list_len = 6131 list_len =
6126 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, 6132 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
6127 PATH_MAX, nls_codepage, remap); 6133 PATH_MAX, nls_codepage, remap);
6128 list_len++; /* trailing null */ 6134 list_len++; /* trailing null */
6129 list_len *= 2; 6135 list_len *= 2;
6130 } else { /* BB improve the check for buffer overruns BB */ 6136 } else { /* BB improve the check for buffer overruns BB */
@@ -6301,8 +6307,8 @@ SetEARetry:
6301 6307
6302 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 6308 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
6303 name_len = 6309 name_len =
6304 cifsConvertToUCS((__le16 *) pSMB->FileName, fileName, 6310 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
6305 PATH_MAX, nls_codepage, remap); 6311 PATH_MAX, nls_codepage, remap);
6306 name_len++; /* trailing null */ 6312 name_len++; /* trailing null */
6307 name_len *= 2; 6313 name_len *= 2;
6308 } else { /* BB improve the check for buffer overruns BB */ 6314 } else { /* BB improve the check for buffer overruns BB */