diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsfs.c | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 90 | ||||
-rw-r--r-- | fs/cifs/dir.c | 27 |
3 files changed, 58 insertions, 61 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index d2d16a9c1f05..877095a1192a 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -816,7 +816,7 @@ static int cifs_oplock_thread(void * dummyarg) | |||
816 | 816 | ||
817 | oplockThread = current; | 817 | oplockThread = current; |
818 | do { | 818 | do { |
819 | if(try_to_freeze()) | 819 | if (try_to_freeze()) |
820 | continue; | 820 | continue; |
821 | 821 | ||
822 | spin_lock(&GlobalMid_Lock); | 822 | spin_lock(&GlobalMid_Lock); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index a8f0cbada0f0..d74367a08d51 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -357,7 +357,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
357 | } | 357 | } |
358 | 358 | ||
359 | while (server->tcpStatus != CifsExiting) { | 359 | while (server->tcpStatus != CifsExiting) { |
360 | if(try_to_freeze()) | 360 | if (try_to_freeze()) |
361 | continue; | 361 | continue; |
362 | if (bigbuf == NULL) { | 362 | if (bigbuf == NULL) { |
363 | bigbuf = cifs_buf_get(); | 363 | bigbuf = cifs_buf_get(); |
@@ -871,7 +871,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
871 | /* go from value to value + temp_len condensing | 871 | /* go from value to value + temp_len condensing |
872 | double commas to singles. Note that this ends up | 872 | double commas to singles. Note that this ends up |
873 | allocating a few bytes too many, which is ok */ | 873 | allocating a few bytes too many, which is ok */ |
874 | vol->password = kcalloc(1, temp_len, GFP_KERNEL); | 874 | vol->password = kzalloc(temp_len, GFP_KERNEL); |
875 | if(vol->password == NULL) { | 875 | if(vol->password == NULL) { |
876 | printk("CIFS: no memory for pass\n"); | 876 | printk("CIFS: no memory for pass\n"); |
877 | return 1; | 877 | return 1; |
@@ -886,7 +886,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
886 | } | 886 | } |
887 | vol->password[j] = 0; | 887 | vol->password[j] = 0; |
888 | } else { | 888 | } else { |
889 | vol->password = kcalloc(1, temp_len+1, GFP_KERNEL); | 889 | vol->password = kzalloc(temp_len+1, GFP_KERNEL); |
890 | if(vol->password == NULL) { | 890 | if(vol->password == NULL) { |
891 | printk("CIFS: no memory for pass\n"); | 891 | printk("CIFS: no memory for pass\n"); |
892 | return 1; | 892 | return 1; |
@@ -1403,7 +1403,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket, | |||
1403 | sessinit is sent but no second negprot */ | 1403 | sessinit is sent but no second negprot */ |
1404 | struct rfc1002_session_packet * ses_init_buf; | 1404 | struct rfc1002_session_packet * ses_init_buf; |
1405 | struct smb_hdr * smb_buf; | 1405 | struct smb_hdr * smb_buf; |
1406 | ses_init_buf = kcalloc(1, sizeof(struct rfc1002_session_packet), GFP_KERNEL); | 1406 | ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL); |
1407 | if(ses_init_buf) { | 1407 | if(ses_init_buf) { |
1408 | ses_init_buf->trailer.session_req.called_len = 32; | 1408 | ses_init_buf->trailer.session_req.called_len = 32; |
1409 | if(target_name && (target_name[0] != 0)) { | 1409 | if(target_name && (target_name[0] != 0)) { |
@@ -2101,7 +2101,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2101 | /* We look for obvious messed up bcc or strings in response so we do not go off | 2101 | /* We look for obvious messed up bcc or strings in response so we do not go off |
2102 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2102 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
2103 | terminating last Unicode string in response */ | 2103 | terminating last Unicode string in response */ |
2104 | ses->serverOS = kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 2104 | ses->serverOS = kzalloc(2 * (len + 1), GFP_KERNEL); |
2105 | if(ses->serverOS == NULL) | 2105 | if(ses->serverOS == NULL) |
2106 | goto sesssetup_nomem; | 2106 | goto sesssetup_nomem; |
2107 | cifs_strfromUCS_le(ses->serverOS, | 2107 | cifs_strfromUCS_le(ses->serverOS, |
@@ -2113,7 +2113,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2113 | if (remaining_words > 0) { | 2113 | if (remaining_words > 0) { |
2114 | len = UniStrnlen((wchar_t *)bcc_ptr, | 2114 | len = UniStrnlen((wchar_t *)bcc_ptr, |
2115 | remaining_words-1); | 2115 | remaining_words-1); |
2116 | ses->serverNOS = kcalloc(1, 2 * (len + 1),GFP_KERNEL); | 2116 | ses->serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL); |
2117 | if(ses->serverNOS == NULL) | 2117 | if(ses->serverNOS == NULL) |
2118 | goto sesssetup_nomem; | 2118 | goto sesssetup_nomem; |
2119 | cifs_strfromUCS_le(ses->serverNOS, | 2119 | cifs_strfromUCS_le(ses->serverNOS, |
@@ -2131,7 +2131,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2131 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2131 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
2132 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2132 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
2133 | ses->serverDomain = | 2133 | ses->serverDomain = |
2134 | kcalloc(1, 2*(len+1),GFP_KERNEL); | 2134 | kzalloc(2*(len+1),GFP_KERNEL); |
2135 | if(ses->serverDomain == NULL) | 2135 | if(ses->serverDomain == NULL) |
2136 | goto sesssetup_nomem; | 2136 | goto sesssetup_nomem; |
2137 | cifs_strfromUCS_le(ses->serverDomain, | 2137 | cifs_strfromUCS_le(ses->serverDomain, |
@@ -2142,22 +2142,22 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2142 | } /* else no more room so create dummy domain string */ | 2142 | } /* else no more room so create dummy domain string */ |
2143 | else | 2143 | else |
2144 | ses->serverDomain = | 2144 | ses->serverDomain = |
2145 | kcalloc(1, 2, GFP_KERNEL); | 2145 | kzalloc(2, GFP_KERNEL); |
2146 | } else { /* no room so create dummy domain and NOS string */ | 2146 | } else { /* no room so create dummy domain and NOS string */ |
2147 | /* if these kcallocs fail not much we | 2147 | /* if these kcallocs fail not much we |
2148 | can do, but better to not fail the | 2148 | can do, but better to not fail the |
2149 | sesssetup itself */ | 2149 | sesssetup itself */ |
2150 | ses->serverDomain = | 2150 | ses->serverDomain = |
2151 | kcalloc(1, 2, GFP_KERNEL); | 2151 | kzalloc(2, GFP_KERNEL); |
2152 | ses->serverNOS = | 2152 | ses->serverNOS = |
2153 | kcalloc(1, 2, GFP_KERNEL); | 2153 | kzalloc(2, GFP_KERNEL); |
2154 | } | 2154 | } |
2155 | } else { /* ASCII */ | 2155 | } else { /* ASCII */ |
2156 | len = strnlen(bcc_ptr, 1024); | 2156 | len = strnlen(bcc_ptr, 1024); |
2157 | if (((long) bcc_ptr + len) - (long) | 2157 | if (((long) bcc_ptr + len) - (long) |
2158 | pByteArea(smb_buffer_response) | 2158 | pByteArea(smb_buffer_response) |
2159 | <= BCC(smb_buffer_response)) { | 2159 | <= BCC(smb_buffer_response)) { |
2160 | ses->serverOS = kcalloc(1, len + 1,GFP_KERNEL); | 2160 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); |
2161 | if(ses->serverOS == NULL) | 2161 | if(ses->serverOS == NULL) |
2162 | goto sesssetup_nomem; | 2162 | goto sesssetup_nomem; |
2163 | strncpy(ses->serverOS,bcc_ptr, len); | 2163 | strncpy(ses->serverOS,bcc_ptr, len); |
@@ -2167,7 +2167,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2167 | bcc_ptr++; | 2167 | bcc_ptr++; |
2168 | 2168 | ||
2169 | len = strnlen(bcc_ptr, 1024); | 2169 | len = strnlen(bcc_ptr, 1024); |
2170 | ses->serverNOS = kcalloc(1, len + 1,GFP_KERNEL); | 2170 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); |
2171 | if(ses->serverNOS == NULL) | 2171 | if(ses->serverNOS == NULL) |
2172 | goto sesssetup_nomem; | 2172 | goto sesssetup_nomem; |
2173 | strncpy(ses->serverNOS, bcc_ptr, len); | 2173 | strncpy(ses->serverNOS, bcc_ptr, len); |
@@ -2176,7 +2176,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2176 | bcc_ptr++; | 2176 | bcc_ptr++; |
2177 | 2177 | ||
2178 | len = strnlen(bcc_ptr, 1024); | 2178 | len = strnlen(bcc_ptr, 1024); |
2179 | ses->serverDomain = kcalloc(1, len + 1,GFP_KERNEL); | 2179 | ses->serverDomain = kzalloc(len + 1,GFP_KERNEL); |
2180 | if(ses->serverDomain == NULL) | 2180 | if(ses->serverDomain == NULL) |
2181 | goto sesssetup_nomem; | 2181 | goto sesssetup_nomem; |
2182 | strncpy(ses->serverDomain, bcc_ptr, len); | 2182 | strncpy(ses->serverDomain, bcc_ptr, len); |
@@ -2379,7 +2379,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2379 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2379 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
2380 | terminating last Unicode string in response */ | 2380 | terminating last Unicode string in response */ |
2381 | ses->serverOS = | 2381 | ses->serverOS = |
2382 | kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 2382 | kzalloc(2 * (len + 1), GFP_KERNEL); |
2383 | cifs_strfromUCS_le(ses->serverOS, | 2383 | cifs_strfromUCS_le(ses->serverOS, |
2384 | (wchar_t *) | 2384 | (wchar_t *) |
2385 | bcc_ptr, len, | 2385 | bcc_ptr, len, |
@@ -2393,7 +2393,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2393 | remaining_words | 2393 | remaining_words |
2394 | - 1); | 2394 | - 1); |
2395 | ses->serverNOS = | 2395 | ses->serverNOS = |
2396 | kcalloc(1, 2 * (len + 1), | 2396 | kzalloc(2 * (len + 1), |
2397 | GFP_KERNEL); | 2397 | GFP_KERNEL); |
2398 | cifs_strfromUCS_le(ses->serverNOS, | 2398 | cifs_strfromUCS_le(ses->serverNOS, |
2399 | (wchar_t *)bcc_ptr, | 2399 | (wchar_t *)bcc_ptr, |
@@ -2406,7 +2406,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2406 | if (remaining_words > 0) { | 2406 | if (remaining_words > 0) { |
2407 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2407 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
2408 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2408 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
2409 | ses->serverDomain = kcalloc(1, 2*(len+1),GFP_KERNEL); | 2409 | ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); |
2410 | cifs_strfromUCS_le(ses->serverDomain, | 2410 | cifs_strfromUCS_le(ses->serverDomain, |
2411 | (wchar_t *)bcc_ptr, | 2411 | (wchar_t *)bcc_ptr, |
2412 | len, | 2412 | len, |
@@ -2417,10 +2417,10 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2417 | } /* else no more room so create dummy domain string */ | 2417 | } /* else no more room so create dummy domain string */ |
2418 | else | 2418 | else |
2419 | ses->serverDomain = | 2419 | ses->serverDomain = |
2420 | kcalloc(1, 2,GFP_KERNEL); | 2420 | kzalloc(2,GFP_KERNEL); |
2421 | } else { /* no room so create dummy domain and NOS string */ | 2421 | } else { /* no room so create dummy domain and NOS string */ |
2422 | ses->serverDomain = kcalloc(1, 2, GFP_KERNEL); | 2422 | ses->serverDomain = kzalloc(2, GFP_KERNEL); |
2423 | ses->serverNOS = kcalloc(1, 2, GFP_KERNEL); | 2423 | ses->serverNOS = kzalloc(2, GFP_KERNEL); |
2424 | } | 2424 | } |
2425 | } else { /* ASCII */ | 2425 | } else { /* ASCII */ |
2426 | 2426 | ||
@@ -2428,7 +2428,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2428 | if (((long) bcc_ptr + len) - (long) | 2428 | if (((long) bcc_ptr + len) - (long) |
2429 | pByteArea(smb_buffer_response) | 2429 | pByteArea(smb_buffer_response) |
2430 | <= BCC(smb_buffer_response)) { | 2430 | <= BCC(smb_buffer_response)) { |
2431 | ses->serverOS = kcalloc(1, len + 1, GFP_KERNEL); | 2431 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); |
2432 | strncpy(ses->serverOS, bcc_ptr, len); | 2432 | strncpy(ses->serverOS, bcc_ptr, len); |
2433 | 2433 | ||
2434 | bcc_ptr += len; | 2434 | bcc_ptr += len; |
@@ -2436,14 +2436,14 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2436 | bcc_ptr++; | 2436 | bcc_ptr++; |
2437 | 2437 | ||
2438 | len = strnlen(bcc_ptr, 1024); | 2438 | len = strnlen(bcc_ptr, 1024); |
2439 | ses->serverNOS = kcalloc(1, len + 1,GFP_KERNEL); | 2439 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); |
2440 | strncpy(ses->serverNOS, bcc_ptr, len); | 2440 | strncpy(ses->serverNOS, bcc_ptr, len); |
2441 | bcc_ptr += len; | 2441 | bcc_ptr += len; |
2442 | bcc_ptr[0] = 0; | 2442 | bcc_ptr[0] = 0; |
2443 | bcc_ptr++; | 2443 | bcc_ptr++; |
2444 | 2444 | ||
2445 | len = strnlen(bcc_ptr, 1024); | 2445 | len = strnlen(bcc_ptr, 1024); |
2446 | ses->serverDomain = kcalloc(1, len + 1, GFP_KERNEL); | 2446 | ses->serverDomain = kzalloc(len + 1, GFP_KERNEL); |
2447 | strncpy(ses->serverDomain, bcc_ptr, len); | 2447 | strncpy(ses->serverDomain, bcc_ptr, len); |
2448 | bcc_ptr += len; | 2448 | bcc_ptr += len; |
2449 | bcc_ptr[0] = 0; | 2449 | bcc_ptr[0] = 0; |
@@ -2695,7 +2695,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2695 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2695 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
2696 | terminating last Unicode string in response */ | 2696 | terminating last Unicode string in response */ |
2697 | ses->serverOS = | 2697 | ses->serverOS = |
2698 | kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 2698 | kzalloc(2 * (len + 1), GFP_KERNEL); |
2699 | cifs_strfromUCS_le(ses->serverOS, | 2699 | cifs_strfromUCS_le(ses->serverOS, |
2700 | (wchar_t *) | 2700 | (wchar_t *) |
2701 | bcc_ptr, len, | 2701 | bcc_ptr, len, |
@@ -2710,7 +2710,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2710 | remaining_words | 2710 | remaining_words |
2711 | - 1); | 2711 | - 1); |
2712 | ses->serverNOS = | 2712 | ses->serverNOS = |
2713 | kcalloc(1, 2 * (len + 1), | 2713 | kzalloc(2 * (len + 1), |
2714 | GFP_KERNEL); | 2714 | GFP_KERNEL); |
2715 | cifs_strfromUCS_le(ses-> | 2715 | cifs_strfromUCS_le(ses-> |
2716 | serverNOS, | 2716 | serverNOS, |
@@ -2727,7 +2727,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2727 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2727 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
2728 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2728 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
2729 | ses->serverDomain = | 2729 | ses->serverDomain = |
2730 | kcalloc(1, 2 * | 2730 | kzalloc(2 * |
2731 | (len + | 2731 | (len + |
2732 | 1), | 2732 | 1), |
2733 | GFP_KERNEL); | 2733 | GFP_KERNEL); |
@@ -2753,13 +2753,13 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2753 | } /* else no more room so create dummy domain string */ | 2753 | } /* else no more room so create dummy domain string */ |
2754 | else | 2754 | else |
2755 | ses->serverDomain = | 2755 | ses->serverDomain = |
2756 | kcalloc(1, 2, | 2756 | kzalloc(2, |
2757 | GFP_KERNEL); | 2757 | GFP_KERNEL); |
2758 | } else { /* no room so create dummy domain and NOS string */ | 2758 | } else { /* no room so create dummy domain and NOS string */ |
2759 | ses->serverDomain = | 2759 | ses->serverDomain = |
2760 | kcalloc(1, 2, GFP_KERNEL); | 2760 | kzalloc(2, GFP_KERNEL); |
2761 | ses->serverNOS = | 2761 | ses->serverNOS = |
2762 | kcalloc(1, 2, GFP_KERNEL); | 2762 | kzalloc(2, GFP_KERNEL); |
2763 | } | 2763 | } |
2764 | } else { /* ASCII */ | 2764 | } else { /* ASCII */ |
2765 | len = strnlen(bcc_ptr, 1024); | 2765 | len = strnlen(bcc_ptr, 1024); |
@@ -2767,7 +2767,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2767 | pByteArea(smb_buffer_response) | 2767 | pByteArea(smb_buffer_response) |
2768 | <= BCC(smb_buffer_response)) { | 2768 | <= BCC(smb_buffer_response)) { |
2769 | ses->serverOS = | 2769 | ses->serverOS = |
2770 | kcalloc(1, len + 1, | 2770 | kzalloc(len + 1, |
2771 | GFP_KERNEL); | 2771 | GFP_KERNEL); |
2772 | strncpy(ses->serverOS, | 2772 | strncpy(ses->serverOS, |
2773 | bcc_ptr, len); | 2773 | bcc_ptr, len); |
@@ -2778,7 +2778,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2778 | 2778 | ||
2779 | len = strnlen(bcc_ptr, 1024); | 2779 | len = strnlen(bcc_ptr, 1024); |
2780 | ses->serverNOS = | 2780 | ses->serverNOS = |
2781 | kcalloc(1, len + 1, | 2781 | kzalloc(len + 1, |
2782 | GFP_KERNEL); | 2782 | GFP_KERNEL); |
2783 | strncpy(ses->serverNOS, bcc_ptr, len); | 2783 | strncpy(ses->serverNOS, bcc_ptr, len); |
2784 | bcc_ptr += len; | 2784 | bcc_ptr += len; |
@@ -2787,7 +2787,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2787 | 2787 | ||
2788 | len = strnlen(bcc_ptr, 1024); | 2788 | len = strnlen(bcc_ptr, 1024); |
2789 | ses->serverDomain = | 2789 | ses->serverDomain = |
2790 | kcalloc(1, len + 1, | 2790 | kzalloc(len + 1, |
2791 | GFP_KERNEL); | 2791 | GFP_KERNEL); |
2792 | strncpy(ses->serverDomain, bcc_ptr, len); | 2792 | strncpy(ses->serverDomain, bcc_ptr, len); |
2793 | bcc_ptr += len; | 2793 | bcc_ptr += len; |
@@ -3091,7 +3091,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3091 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 3091 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
3092 | terminating last Unicode string in response */ | 3092 | terminating last Unicode string in response */ |
3093 | ses->serverOS = | 3093 | ses->serverOS = |
3094 | kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 3094 | kzalloc(2 * (len + 1), GFP_KERNEL); |
3095 | cifs_strfromUCS_le(ses->serverOS, | 3095 | cifs_strfromUCS_le(ses->serverOS, |
3096 | (wchar_t *) | 3096 | (wchar_t *) |
3097 | bcc_ptr, len, | 3097 | bcc_ptr, len, |
@@ -3106,7 +3106,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3106 | remaining_words | 3106 | remaining_words |
3107 | - 1); | 3107 | - 1); |
3108 | ses->serverNOS = | 3108 | ses->serverNOS = |
3109 | kcalloc(1, 2 * (len + 1), | 3109 | kzalloc(2 * (len + 1), |
3110 | GFP_KERNEL); | 3110 | GFP_KERNEL); |
3111 | cifs_strfromUCS_le(ses-> | 3111 | cifs_strfromUCS_le(ses-> |
3112 | serverNOS, | 3112 | serverNOS, |
@@ -3122,7 +3122,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3122 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 3122 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
3123 | /* last string not always null terminated (e.g. for Windows XP & 2000) */ | 3123 | /* last string not always null terminated (e.g. for Windows XP & 2000) */ |
3124 | ses->serverDomain = | 3124 | ses->serverDomain = |
3125 | kcalloc(1, 2 * | 3125 | kzalloc(2 * |
3126 | (len + | 3126 | (len + |
3127 | 1), | 3127 | 1), |
3128 | GFP_KERNEL); | 3128 | GFP_KERNEL); |
@@ -3147,17 +3147,17 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3147 | = 0; | 3147 | = 0; |
3148 | } /* else no more room so create dummy domain string */ | 3148 | } /* else no more room so create dummy domain string */ |
3149 | else | 3149 | else |
3150 | ses->serverDomain = kcalloc(1, 2,GFP_KERNEL); | 3150 | ses->serverDomain = kzalloc(2,GFP_KERNEL); |
3151 | } else { /* no room so create dummy domain and NOS string */ | 3151 | } else { /* no room so create dummy domain and NOS string */ |
3152 | ses->serverDomain = kcalloc(1, 2, GFP_KERNEL); | 3152 | ses->serverDomain = kzalloc(2, GFP_KERNEL); |
3153 | ses->serverNOS = kcalloc(1, 2, GFP_KERNEL); | 3153 | ses->serverNOS = kzalloc(2, GFP_KERNEL); |
3154 | } | 3154 | } |
3155 | } else { /* ASCII */ | 3155 | } else { /* ASCII */ |
3156 | len = strnlen(bcc_ptr, 1024); | 3156 | len = strnlen(bcc_ptr, 1024); |
3157 | if (((long) bcc_ptr + len) - | 3157 | if (((long) bcc_ptr + len) - |
3158 | (long) pByteArea(smb_buffer_response) | 3158 | (long) pByteArea(smb_buffer_response) |
3159 | <= BCC(smb_buffer_response)) { | 3159 | <= BCC(smb_buffer_response)) { |
3160 | ses->serverOS = kcalloc(1, len + 1,GFP_KERNEL); | 3160 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); |
3161 | strncpy(ses->serverOS,bcc_ptr, len); | 3161 | strncpy(ses->serverOS,bcc_ptr, len); |
3162 | 3162 | ||
3163 | bcc_ptr += len; | 3163 | bcc_ptr += len; |
@@ -3165,14 +3165,14 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3165 | bcc_ptr++; | 3165 | bcc_ptr++; |
3166 | 3166 | ||
3167 | len = strnlen(bcc_ptr, 1024); | 3167 | len = strnlen(bcc_ptr, 1024); |
3168 | ses->serverNOS = kcalloc(1, len+1,GFP_KERNEL); | 3168 | ses->serverNOS = kzalloc(len+1,GFP_KERNEL); |
3169 | strncpy(ses->serverNOS, bcc_ptr, len); | 3169 | strncpy(ses->serverNOS, bcc_ptr, len); |
3170 | bcc_ptr += len; | 3170 | bcc_ptr += len; |
3171 | bcc_ptr[0] = 0; | 3171 | bcc_ptr[0] = 0; |
3172 | bcc_ptr++; | 3172 | bcc_ptr++; |
3173 | 3173 | ||
3174 | len = strnlen(bcc_ptr, 1024); | 3174 | len = strnlen(bcc_ptr, 1024); |
3175 | ses->serverDomain = kcalloc(1, len+1,GFP_KERNEL); | 3175 | ses->serverDomain = kzalloc(len+1,GFP_KERNEL); |
3176 | strncpy(ses->serverDomain, bcc_ptr, len); | 3176 | strncpy(ses->serverDomain, bcc_ptr, len); |
3177 | bcc_ptr += len; | 3177 | bcc_ptr += len; |
3178 | bcc_ptr[0] = 0; | 3178 | bcc_ptr[0] = 0; |
@@ -3286,7 +3286,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3286 | if(tcon->nativeFileSystem) | 3286 | if(tcon->nativeFileSystem) |
3287 | kfree(tcon->nativeFileSystem); | 3287 | kfree(tcon->nativeFileSystem); |
3288 | tcon->nativeFileSystem = | 3288 | tcon->nativeFileSystem = |
3289 | kcalloc(1, length + 2, GFP_KERNEL); | 3289 | kzalloc(length + 2, GFP_KERNEL); |
3290 | cifs_strfromUCS_le(tcon->nativeFileSystem, | 3290 | cifs_strfromUCS_le(tcon->nativeFileSystem, |
3291 | (wchar_t *) bcc_ptr, | 3291 | (wchar_t *) bcc_ptr, |
3292 | length, nls_codepage); | 3292 | length, nls_codepage); |
@@ -3304,7 +3304,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3304 | if(tcon->nativeFileSystem) | 3304 | if(tcon->nativeFileSystem) |
3305 | kfree(tcon->nativeFileSystem); | 3305 | kfree(tcon->nativeFileSystem); |
3306 | tcon->nativeFileSystem = | 3306 | tcon->nativeFileSystem = |
3307 | kcalloc(1, length + 1, GFP_KERNEL); | 3307 | kzalloc(length + 1, GFP_KERNEL); |
3308 | strncpy(tcon->nativeFileSystem, bcc_ptr, | 3308 | strncpy(tcon->nativeFileSystem, bcc_ptr, |
3309 | length); | 3309 | length); |
3310 | } | 3310 | } |
@@ -3362,10 +3362,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3362 | } | 3362 | } |
3363 | 3363 | ||
3364 | cifs_sb->tcon = NULL; | 3364 | cifs_sb->tcon = NULL; |
3365 | if (ses) { | 3365 | if (ses) |
3366 | set_current_state(TASK_INTERRUPTIBLE); | 3366 | schedule_timeout_interruptible(msecs_to_jiffies(500)); |
3367 | schedule_timeout(HZ / 2); | ||
3368 | } | ||
3369 | if (ses) | 3367 | if (ses) |
3370 | sesInfoFree(ses); | 3368 | sesInfoFree(ses); |
3371 | 3369 | ||
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index cf90c9ad2c87..8dfe717a332a 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -146,24 +146,23 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
146 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | } | 147 | } |
148 | 148 | ||
149 | if(nd) { | 149 | if(nd && (nd->flags & LOOKUP_OPEN)) { |
150 | if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY) | 150 | int oflags = nd->intent.open.flags; |
151 | desiredAccess = GENERIC_READ; | 151 | |
152 | else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) { | 152 | desiredAccess = 0; |
153 | desiredAccess = GENERIC_WRITE; | 153 | if (oflags & FMODE_READ) |
154 | write_only = TRUE; | 154 | desiredAccess |= GENERIC_READ; |
155 | } else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) { | 155 | if (oflags & FMODE_WRITE) { |
156 | /* GENERIC_ALL is too much permission to request */ | 156 | desiredAccess |= GENERIC_WRITE; |
157 | /* can cause unnecessary access denied on create */ | 157 | if (!(oflags & FMODE_READ)) |
158 | /* desiredAccess = GENERIC_ALL; */ | 158 | write_only = TRUE; |
159 | desiredAccess = GENERIC_READ | GENERIC_WRITE; | ||
160 | } | 159 | } |
161 | 160 | ||
162 | if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | 161 | if((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) |
163 | disposition = FILE_CREATE; | 162 | disposition = FILE_CREATE; |
164 | else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) | 163 | else if((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) |
165 | disposition = FILE_OVERWRITE_IF; | 164 | disposition = FILE_OVERWRITE_IF; |
166 | else if((nd->intent.open.flags & O_CREAT) == O_CREAT) | 165 | else if((oflags & O_CREAT) == O_CREAT) |
167 | disposition = FILE_OPEN_IF; | 166 | disposition = FILE_OPEN_IF; |
168 | else { | 167 | else { |
169 | cFYI(1,("Create flag not set in create function")); | 168 | cFYI(1,("Create flag not set in create function")); |