diff options
Diffstat (limited to 'fs/cifs')
| -rw-r--r-- | fs/cifs/CHANGES | 6 | ||||
| -rw-r--r-- | fs/cifs/cifsfs.h | 4 | ||||
| -rw-r--r-- | fs/cifs/cifssmb.c | 3 | ||||
| -rw-r--r-- | fs/cifs/connect.c | 88 | ||||
| -rw-r--r-- | fs/cifs/dir.c | 27 | ||||
| -rw-r--r-- | fs/cifs/file.c | 2 | ||||
| -rw-r--r-- | fs/cifs/link.c | 6 | ||||
| -rw-r--r-- | fs/cifs/misc.c | 1 |
8 files changed, 72 insertions, 65 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index dab4774ee7bb..3196d4c4eed3 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | Version 1.35 | ||
| 2 | ------------ | ||
| 3 | Add writepage performance improvements. Fix path name conversions | ||
| 4 | for long filenames on mounts which were done with "mapchars" mount option | ||
| 5 | specified. | ||
| 6 | |||
| 1 | Version 1.34 | 7 | Version 1.34 |
| 2 | ------------ | 8 | ------------ |
| 3 | Fix error mapping of the TOO_MANY_LINKS (hardlinks) case. | 9 | Fix error mapping of the TOO_MANY_LINKS (hardlinks) case. |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 78af5850c558..1fd21f66f243 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
| @@ -83,8 +83,8 @@ extern int cifs_dir_notify(struct file *, unsigned long arg); | |||
| 83 | extern struct dentry_operations cifs_dentry_ops; | 83 | extern struct dentry_operations cifs_dentry_ops; |
| 84 | 84 | ||
| 85 | /* Functions related to symlinks */ | 85 | /* Functions related to symlinks */ |
| 86 | extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd); | 86 | extern void *cifs_follow_link(struct dentry *direntry, struct nameidata *nd); |
| 87 | extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd); | 87 | extern void cifs_put_link(struct dentry *direntry, struct nameidata *nd, void *); |
| 88 | extern int cifs_readlink(struct dentry *direntry, char __user *buffer, | 88 | extern int cifs_readlink(struct dentry *direntry, char __user *buffer, |
| 89 | int buflen); | 89 | int buflen); |
| 90 | extern int cifs_symlink(struct inode *inode, struct dentry *direntry, | 90 | extern int cifs_symlink(struct inode *inode, struct dentry *direntry, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 3c628bf667a5..0db0b313d715 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
| @@ -2602,6 +2602,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
| 2602 | if(name_len < PATH_MAX) { | 2602 | if(name_len < PATH_MAX) { |
| 2603 | memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len); | 2603 | memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len); |
| 2604 | byte_count += name_len; | 2604 | byte_count += name_len; |
| 2605 | /* 14 byte parm len above enough for 2 byte null terminator */ | ||
| 2606 | pSMB->ResumeFileName[name_len] = 0; | ||
| 2607 | pSMB->ResumeFileName[name_len+1] = 0; | ||
| 2605 | } else { | 2608 | } else { |
| 2606 | rc = -EINVAL; | 2609 | rc = -EINVAL; |
| 2607 | goto FNext2_err_exit; | 2610 | goto FNext2_err_exit; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e568cc47a7f9..2335f14a1583 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -836,7 +836,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
| 836 | /* go from value to value + temp_len condensing | 836 | /* go from value to value + temp_len condensing |
| 837 | double commas to singles. Note that this ends up | 837 | double commas to singles. Note that this ends up |
| 838 | allocating a few bytes too many, which is ok */ | 838 | allocating a few bytes too many, which is ok */ |
| 839 | vol->password = kcalloc(1, temp_len, GFP_KERNEL); | 839 | vol->password = kzalloc(temp_len, GFP_KERNEL); |
| 840 | if(vol->password == NULL) { | 840 | if(vol->password == NULL) { |
| 841 | printk("CIFS: no memory for pass\n"); | 841 | printk("CIFS: no memory for pass\n"); |
| 842 | return 1; | 842 | return 1; |
| @@ -851,7 +851,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
| 851 | } | 851 | } |
| 852 | vol->password[j] = 0; | 852 | vol->password[j] = 0; |
| 853 | } else { | 853 | } else { |
| 854 | vol->password = kcalloc(1, temp_len+1, GFP_KERNEL); | 854 | vol->password = kzalloc(temp_len+1, GFP_KERNEL); |
| 855 | if(vol->password == NULL) { | 855 | if(vol->password == NULL) { |
| 856 | printk("CIFS: no memory for pass\n"); | 856 | printk("CIFS: no memory for pass\n"); |
| 857 | return 1; | 857 | return 1; |
| @@ -1317,7 +1317,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket, | |||
| 1317 | sessinit is sent but no second negprot */ | 1317 | sessinit is sent but no second negprot */ |
| 1318 | struct rfc1002_session_packet * ses_init_buf; | 1318 | struct rfc1002_session_packet * ses_init_buf; |
| 1319 | struct smb_hdr * smb_buf; | 1319 | struct smb_hdr * smb_buf; |
| 1320 | ses_init_buf = kcalloc(1, sizeof(struct rfc1002_session_packet), GFP_KERNEL); | 1320 | ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL); |
| 1321 | if(ses_init_buf) { | 1321 | if(ses_init_buf) { |
| 1322 | ses_init_buf->trailer.session_req.called_len = 32; | 1322 | ses_init_buf->trailer.session_req.called_len = 32; |
| 1323 | rfc1002mangle(ses_init_buf->trailer.session_req.called_name, | 1323 | rfc1002mangle(ses_init_buf->trailer.session_req.called_name, |
| @@ -1964,7 +1964,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 1964 | /* We look for obvious messed up bcc or strings in response so we do not go off | 1964 | /* We look for obvious messed up bcc or strings in response so we do not go off |
| 1965 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 1965 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
| 1966 | terminating last Unicode string in response */ | 1966 | terminating last Unicode string in response */ |
| 1967 | ses->serverOS = kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 1967 | ses->serverOS = kzalloc(2 * (len + 1), GFP_KERNEL); |
| 1968 | if(ses->serverOS == NULL) | 1968 | if(ses->serverOS == NULL) |
| 1969 | goto sesssetup_nomem; | 1969 | goto sesssetup_nomem; |
| 1970 | cifs_strfromUCS_le(ses->serverOS, | 1970 | cifs_strfromUCS_le(ses->serverOS, |
| @@ -1976,7 +1976,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 1976 | if (remaining_words > 0) { | 1976 | if (remaining_words > 0) { |
| 1977 | len = UniStrnlen((wchar_t *)bcc_ptr, | 1977 | len = UniStrnlen((wchar_t *)bcc_ptr, |
| 1978 | remaining_words-1); | 1978 | remaining_words-1); |
| 1979 | ses->serverNOS = kcalloc(1, 2 * (len + 1),GFP_KERNEL); | 1979 | ses->serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL); |
| 1980 | if(ses->serverNOS == NULL) | 1980 | if(ses->serverNOS == NULL) |
| 1981 | goto sesssetup_nomem; | 1981 | goto sesssetup_nomem; |
| 1982 | cifs_strfromUCS_le(ses->serverNOS, | 1982 | cifs_strfromUCS_le(ses->serverNOS, |
| @@ -1994,7 +1994,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 1994 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 1994 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
| 1995 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 1995 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
| 1996 | ses->serverDomain = | 1996 | ses->serverDomain = |
| 1997 | kcalloc(1, 2*(len+1),GFP_KERNEL); | 1997 | kzalloc(2*(len+1),GFP_KERNEL); |
| 1998 | if(ses->serverDomain == NULL) | 1998 | if(ses->serverDomain == NULL) |
| 1999 | goto sesssetup_nomem; | 1999 | goto sesssetup_nomem; |
| 2000 | cifs_strfromUCS_le(ses->serverDomain, | 2000 | cifs_strfromUCS_le(ses->serverDomain, |
| @@ -2005,22 +2005,22 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2005 | } /* else no more room so create dummy domain string */ | 2005 | } /* else no more room so create dummy domain string */ |
| 2006 | else | 2006 | else |
| 2007 | ses->serverDomain = | 2007 | ses->serverDomain = |
| 2008 | kcalloc(1, 2, GFP_KERNEL); | 2008 | kzalloc(2, GFP_KERNEL); |
| 2009 | } else { /* no room so create dummy domain and NOS string */ | 2009 | } else { /* no room so create dummy domain and NOS string */ |
| 2010 | /* if these kcallocs fail not much we | 2010 | /* if these kcallocs fail not much we |
| 2011 | can do, but better to not fail the | 2011 | can do, but better to not fail the |
| 2012 | sesssetup itself */ | 2012 | sesssetup itself */ |
| 2013 | ses->serverDomain = | 2013 | ses->serverDomain = |
| 2014 | kcalloc(1, 2, GFP_KERNEL); | 2014 | kzalloc(2, GFP_KERNEL); |
| 2015 | ses->serverNOS = | 2015 | ses->serverNOS = |
| 2016 | kcalloc(1, 2, GFP_KERNEL); | 2016 | kzalloc(2, GFP_KERNEL); |
| 2017 | } | 2017 | } |
| 2018 | } else { /* ASCII */ | 2018 | } else { /* ASCII */ |
| 2019 | len = strnlen(bcc_ptr, 1024); | 2019 | len = strnlen(bcc_ptr, 1024); |
| 2020 | if (((long) bcc_ptr + len) - (long) | 2020 | if (((long) bcc_ptr + len) - (long) |
| 2021 | pByteArea(smb_buffer_response) | 2021 | pByteArea(smb_buffer_response) |
| 2022 | <= BCC(smb_buffer_response)) { | 2022 | <= BCC(smb_buffer_response)) { |
| 2023 | ses->serverOS = kcalloc(1, len + 1,GFP_KERNEL); | 2023 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); |
| 2024 | if(ses->serverOS == NULL) | 2024 | if(ses->serverOS == NULL) |
| 2025 | goto sesssetup_nomem; | 2025 | goto sesssetup_nomem; |
| 2026 | strncpy(ses->serverOS,bcc_ptr, len); | 2026 | strncpy(ses->serverOS,bcc_ptr, len); |
| @@ -2030,7 +2030,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2030 | bcc_ptr++; | 2030 | bcc_ptr++; |
| 2031 | 2031 | ||
| 2032 | len = strnlen(bcc_ptr, 1024); | 2032 | len = strnlen(bcc_ptr, 1024); |
| 2033 | ses->serverNOS = kcalloc(1, len + 1,GFP_KERNEL); | 2033 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); |
| 2034 | if(ses->serverNOS == NULL) | 2034 | if(ses->serverNOS == NULL) |
| 2035 | goto sesssetup_nomem; | 2035 | goto sesssetup_nomem; |
| 2036 | strncpy(ses->serverNOS, bcc_ptr, len); | 2036 | strncpy(ses->serverNOS, bcc_ptr, len); |
| @@ -2039,7 +2039,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2039 | bcc_ptr++; | 2039 | bcc_ptr++; |
| 2040 | 2040 | ||
| 2041 | len = strnlen(bcc_ptr, 1024); | 2041 | len = strnlen(bcc_ptr, 1024); |
| 2042 | ses->serverDomain = kcalloc(1, len + 1,GFP_KERNEL); | 2042 | ses->serverDomain = kzalloc(len + 1,GFP_KERNEL); |
| 2043 | if(ses->serverDomain == NULL) | 2043 | if(ses->serverDomain == NULL) |
| 2044 | goto sesssetup_nomem; | 2044 | goto sesssetup_nomem; |
| 2045 | strncpy(ses->serverDomain, bcc_ptr, len); | 2045 | strncpy(ses->serverDomain, bcc_ptr, len); |
| @@ -2240,7 +2240,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2240 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2240 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
| 2241 | terminating last Unicode string in response */ | 2241 | terminating last Unicode string in response */ |
| 2242 | ses->serverOS = | 2242 | ses->serverOS = |
| 2243 | kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 2243 | kzalloc(2 * (len + 1), GFP_KERNEL); |
| 2244 | cifs_strfromUCS_le(ses->serverOS, | 2244 | cifs_strfromUCS_le(ses->serverOS, |
| 2245 | (wchar_t *) | 2245 | (wchar_t *) |
| 2246 | bcc_ptr, len, | 2246 | bcc_ptr, len, |
| @@ -2254,7 +2254,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2254 | remaining_words | 2254 | remaining_words |
| 2255 | - 1); | 2255 | - 1); |
| 2256 | ses->serverNOS = | 2256 | ses->serverNOS = |
| 2257 | kcalloc(1, 2 * (len + 1), | 2257 | kzalloc(2 * (len + 1), |
| 2258 | GFP_KERNEL); | 2258 | GFP_KERNEL); |
| 2259 | cifs_strfromUCS_le(ses->serverNOS, | 2259 | cifs_strfromUCS_le(ses->serverNOS, |
| 2260 | (wchar_t *)bcc_ptr, | 2260 | (wchar_t *)bcc_ptr, |
| @@ -2267,7 +2267,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2267 | if (remaining_words > 0) { | 2267 | if (remaining_words > 0) { |
| 2268 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2268 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
| 2269 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2269 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
| 2270 | ses->serverDomain = kcalloc(1, 2*(len+1),GFP_KERNEL); | 2270 | ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); |
| 2271 | cifs_strfromUCS_le(ses->serverDomain, | 2271 | cifs_strfromUCS_le(ses->serverDomain, |
| 2272 | (wchar_t *)bcc_ptr, | 2272 | (wchar_t *)bcc_ptr, |
| 2273 | len, | 2273 | len, |
| @@ -2278,10 +2278,10 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2278 | } /* else no more room so create dummy domain string */ | 2278 | } /* else no more room so create dummy domain string */ |
| 2279 | else | 2279 | else |
| 2280 | ses->serverDomain = | 2280 | ses->serverDomain = |
| 2281 | kcalloc(1, 2,GFP_KERNEL); | 2281 | kzalloc(2,GFP_KERNEL); |
| 2282 | } else { /* no room so create dummy domain and NOS string */ | 2282 | } else { /* no room so create dummy domain and NOS string */ |
| 2283 | ses->serverDomain = kcalloc(1, 2, GFP_KERNEL); | 2283 | ses->serverDomain = kzalloc(2, GFP_KERNEL); |
| 2284 | ses->serverNOS = kcalloc(1, 2, GFP_KERNEL); | 2284 | ses->serverNOS = kzalloc(2, GFP_KERNEL); |
| 2285 | } | 2285 | } |
| 2286 | } else { /* ASCII */ | 2286 | } else { /* ASCII */ |
| 2287 | 2287 | ||
| @@ -2289,7 +2289,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2289 | if (((long) bcc_ptr + len) - (long) | 2289 | if (((long) bcc_ptr + len) - (long) |
| 2290 | pByteArea(smb_buffer_response) | 2290 | pByteArea(smb_buffer_response) |
| 2291 | <= BCC(smb_buffer_response)) { | 2291 | <= BCC(smb_buffer_response)) { |
| 2292 | ses->serverOS = kcalloc(1, len + 1, GFP_KERNEL); | 2292 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); |
| 2293 | strncpy(ses->serverOS, bcc_ptr, len); | 2293 | strncpy(ses->serverOS, bcc_ptr, len); |
| 2294 | 2294 | ||
| 2295 | bcc_ptr += len; | 2295 | bcc_ptr += len; |
| @@ -2297,14 +2297,14 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2297 | bcc_ptr++; | 2297 | bcc_ptr++; |
| 2298 | 2298 | ||
| 2299 | len = strnlen(bcc_ptr, 1024); | 2299 | len = strnlen(bcc_ptr, 1024); |
| 2300 | ses->serverNOS = kcalloc(1, len + 1,GFP_KERNEL); | 2300 | ses->serverNOS = kzalloc(len + 1,GFP_KERNEL); |
| 2301 | strncpy(ses->serverNOS, bcc_ptr, len); | 2301 | strncpy(ses->serverNOS, bcc_ptr, len); |
| 2302 | bcc_ptr += len; | 2302 | bcc_ptr += len; |
| 2303 | bcc_ptr[0] = 0; | 2303 | bcc_ptr[0] = 0; |
| 2304 | bcc_ptr++; | 2304 | bcc_ptr++; |
| 2305 | 2305 | ||
| 2306 | len = strnlen(bcc_ptr, 1024); | 2306 | len = strnlen(bcc_ptr, 1024); |
| 2307 | ses->serverDomain = kcalloc(1, len + 1, GFP_KERNEL); | 2307 | ses->serverDomain = kzalloc(len + 1, GFP_KERNEL); |
| 2308 | strncpy(ses->serverDomain, bcc_ptr, len); | 2308 | strncpy(ses->serverDomain, bcc_ptr, len); |
| 2309 | bcc_ptr += len; | 2309 | bcc_ptr += len; |
| 2310 | bcc_ptr[0] = 0; | 2310 | bcc_ptr[0] = 0; |
| @@ -2554,7 +2554,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2554 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2554 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
| 2555 | terminating last Unicode string in response */ | 2555 | terminating last Unicode string in response */ |
| 2556 | ses->serverOS = | 2556 | ses->serverOS = |
| 2557 | kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 2557 | kzalloc(2 * (len + 1), GFP_KERNEL); |
| 2558 | cifs_strfromUCS_le(ses->serverOS, | 2558 | cifs_strfromUCS_le(ses->serverOS, |
| 2559 | (wchar_t *) | 2559 | (wchar_t *) |
| 2560 | bcc_ptr, len, | 2560 | bcc_ptr, len, |
| @@ -2569,7 +2569,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2569 | remaining_words | 2569 | remaining_words |
| 2570 | - 1); | 2570 | - 1); |
| 2571 | ses->serverNOS = | 2571 | ses->serverNOS = |
| 2572 | kcalloc(1, 2 * (len + 1), | 2572 | kzalloc(2 * (len + 1), |
| 2573 | GFP_KERNEL); | 2573 | GFP_KERNEL); |
| 2574 | cifs_strfromUCS_le(ses-> | 2574 | cifs_strfromUCS_le(ses-> |
| 2575 | serverNOS, | 2575 | serverNOS, |
| @@ -2586,7 +2586,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2586 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2586 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
| 2587 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2587 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
| 2588 | ses->serverDomain = | 2588 | ses->serverDomain = |
| 2589 | kcalloc(1, 2 * | 2589 | kzalloc(2 * |
| 2590 | (len + | 2590 | (len + |
| 2591 | 1), | 2591 | 1), |
| 2592 | GFP_KERNEL); | 2592 | GFP_KERNEL); |
| @@ -2612,13 +2612,13 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2612 | } /* else no more room so create dummy domain string */ | 2612 | } /* else no more room so create dummy domain string */ |
| 2613 | else | 2613 | else |
| 2614 | ses->serverDomain = | 2614 | ses->serverDomain = |
| 2615 | kcalloc(1, 2, | 2615 | kzalloc(2, |
| 2616 | GFP_KERNEL); | 2616 | GFP_KERNEL); |
| 2617 | } else { /* no room so create dummy domain and NOS string */ | 2617 | } else { /* no room so create dummy domain and NOS string */ |
| 2618 | ses->serverDomain = | 2618 | ses->serverDomain = |
| 2619 | kcalloc(1, 2, GFP_KERNEL); | 2619 | kzalloc(2, GFP_KERNEL); |
| 2620 | ses->serverNOS = | 2620 | ses->serverNOS = |
| 2621 | kcalloc(1, 2, GFP_KERNEL); | 2621 | kzalloc(2, GFP_KERNEL); |
| 2622 | } | 2622 | } |
| 2623 | } else { /* ASCII */ | 2623 | } else { /* ASCII */ |
| 2624 | len = strnlen(bcc_ptr, 1024); | 2624 | len = strnlen(bcc_ptr, 1024); |
| @@ -2626,7 +2626,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2626 | pByteArea(smb_buffer_response) | 2626 | pByteArea(smb_buffer_response) |
| 2627 | <= BCC(smb_buffer_response)) { | 2627 | <= BCC(smb_buffer_response)) { |
| 2628 | ses->serverOS = | 2628 | ses->serverOS = |
| 2629 | kcalloc(1, len + 1, | 2629 | kzalloc(len + 1, |
| 2630 | GFP_KERNEL); | 2630 | GFP_KERNEL); |
| 2631 | strncpy(ses->serverOS, | 2631 | strncpy(ses->serverOS, |
| 2632 | bcc_ptr, len); | 2632 | bcc_ptr, len); |
| @@ -2637,7 +2637,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2637 | 2637 | ||
| 2638 | len = strnlen(bcc_ptr, 1024); | 2638 | len = strnlen(bcc_ptr, 1024); |
| 2639 | ses->serverNOS = | 2639 | ses->serverNOS = |
| 2640 | kcalloc(1, len + 1, | 2640 | kzalloc(len + 1, |
| 2641 | GFP_KERNEL); | 2641 | GFP_KERNEL); |
| 2642 | strncpy(ses->serverNOS, bcc_ptr, len); | 2642 | strncpy(ses->serverNOS, bcc_ptr, len); |
| 2643 | bcc_ptr += len; | 2643 | bcc_ptr += len; |
| @@ -2646,7 +2646,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
| 2646 | 2646 | ||
| 2647 | len = strnlen(bcc_ptr, 1024); | 2647 | len = strnlen(bcc_ptr, 1024); |
| 2648 | ses->serverDomain = | 2648 | ses->serverDomain = |
| 2649 | kcalloc(1, len + 1, | 2649 | kzalloc(len + 1, |
| 2650 | GFP_KERNEL); | 2650 | GFP_KERNEL); |
| 2651 | strncpy(ses->serverDomain, bcc_ptr, len); | 2651 | strncpy(ses->serverDomain, bcc_ptr, len); |
| 2652 | bcc_ptr += len; | 2652 | bcc_ptr += len; |
| @@ -2948,7 +2948,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2948 | the end since (at least) WIN2K and Windows XP have a major bug in not null | 2948 | the end since (at least) WIN2K and Windows XP have a major bug in not null |
| 2949 | terminating last Unicode string in response */ | 2949 | terminating last Unicode string in response */ |
| 2950 | ses->serverOS = | 2950 | ses->serverOS = |
| 2951 | kcalloc(1, 2 * (len + 1), GFP_KERNEL); | 2951 | kzalloc(2 * (len + 1), GFP_KERNEL); |
| 2952 | cifs_strfromUCS_le(ses->serverOS, | 2952 | cifs_strfromUCS_le(ses->serverOS, |
| 2953 | (wchar_t *) | 2953 | (wchar_t *) |
| 2954 | bcc_ptr, len, | 2954 | bcc_ptr, len, |
| @@ -2963,7 +2963,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2963 | remaining_words | 2963 | remaining_words |
| 2964 | - 1); | 2964 | - 1); |
| 2965 | ses->serverNOS = | 2965 | ses->serverNOS = |
| 2966 | kcalloc(1, 2 * (len + 1), | 2966 | kzalloc(2 * (len + 1), |
| 2967 | GFP_KERNEL); | 2967 | GFP_KERNEL); |
| 2968 | cifs_strfromUCS_le(ses-> | 2968 | cifs_strfromUCS_le(ses-> |
| 2969 | serverNOS, | 2969 | serverNOS, |
| @@ -2979,7 +2979,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 2979 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); | 2979 | len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); |
| 2980 | /* last string not always null terminated (e.g. for Windows XP & 2000) */ | 2980 | /* last string not always null terminated (e.g. for Windows XP & 2000) */ |
| 2981 | ses->serverDomain = | 2981 | ses->serverDomain = |
| 2982 | kcalloc(1, 2 * | 2982 | kzalloc(2 * |
| 2983 | (len + | 2983 | (len + |
| 2984 | 1), | 2984 | 1), |
| 2985 | GFP_KERNEL); | 2985 | GFP_KERNEL); |
| @@ -3004,17 +3004,17 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 3004 | = 0; | 3004 | = 0; |
| 3005 | } /* else no more room so create dummy domain string */ | 3005 | } /* else no more room so create dummy domain string */ |
| 3006 | else | 3006 | else |
| 3007 | ses->serverDomain = kcalloc(1, 2,GFP_KERNEL); | 3007 | ses->serverDomain = kzalloc(2,GFP_KERNEL); |
| 3008 | } else { /* no room so create dummy domain and NOS string */ | 3008 | } else { /* no room so create dummy domain and NOS string */ |
| 3009 | ses->serverDomain = kcalloc(1, 2, GFP_KERNEL); | 3009 | ses->serverDomain = kzalloc(2, GFP_KERNEL); |
| 3010 | ses->serverNOS = kcalloc(1, 2, GFP_KERNEL); | 3010 | ses->serverNOS = kzalloc(2, GFP_KERNEL); |
| 3011 | } | 3011 | } |
| 3012 | } else { /* ASCII */ | 3012 | } else { /* ASCII */ |
| 3013 | len = strnlen(bcc_ptr, 1024); | 3013 | len = strnlen(bcc_ptr, 1024); |
| 3014 | if (((long) bcc_ptr + len) - | 3014 | if (((long) bcc_ptr + len) - |
| 3015 | (long) pByteArea(smb_buffer_response) | 3015 | (long) pByteArea(smb_buffer_response) |
| 3016 | <= BCC(smb_buffer_response)) { | 3016 | <= BCC(smb_buffer_response)) { |
| 3017 | ses->serverOS = kcalloc(1, len + 1,GFP_KERNEL); | 3017 | ses->serverOS = kzalloc(len + 1,GFP_KERNEL); |
| 3018 | strncpy(ses->serverOS,bcc_ptr, len); | 3018 | strncpy(ses->serverOS,bcc_ptr, len); |
| 3019 | 3019 | ||
| 3020 | bcc_ptr += len; | 3020 | bcc_ptr += len; |
| @@ -3022,14 +3022,14 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
| 3022 | bcc_ptr++; | 3022 | bcc_ptr++; |
| 3023 | 3023 | ||
| 3024 | len = strnlen(bcc_ptr, 1024); | 3024 | len = strnlen(bcc_ptr, 1024); |
| 3025 | ses->serverNOS = kcalloc(1, len+1,GFP_KERNEL); | 3025 | ses->serverNOS = kzalloc(len+1,GFP_KERNEL); |
| 3026 | strncpy(ses->serverNOS, bcc_ptr, len); | 3026 | strncpy(ses->serverNOS, bcc_ptr, len); |
| 3027 | bcc_ptr += len; | 3027 | bcc_ptr += len; |
| 3028 | bcc_ptr[0] = 0; | 3028 | bcc_ptr[0] = 0; |
| 3029 | bcc_ptr++; | 3029 | bcc_ptr++; |
| 3030 | 3030 | ||
| 3031 | len = strnlen(bcc_ptr, 1024); | 3031 | len = strnlen(bcc_ptr, 1024); |
| 3032 | ses->serverDomain = kcalloc(1, len+1,GFP_KERNEL); | 3032 | ses->serverDomain = kzalloc(len+1,GFP_KERNEL); |
| 3033 | strncpy(ses->serverDomain, bcc_ptr, len); | 3033 | strncpy(ses->serverDomain, bcc_ptr, len); |
| 3034 | bcc_ptr += len; | 3034 | bcc_ptr += len; |
| 3035 | bcc_ptr[0] = 0; | 3035 | bcc_ptr[0] = 0; |
| @@ -3141,7 +3141,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
| 3141 | if(tcon->nativeFileSystem) | 3141 | if(tcon->nativeFileSystem) |
| 3142 | kfree(tcon->nativeFileSystem); | 3142 | kfree(tcon->nativeFileSystem); |
| 3143 | tcon->nativeFileSystem = | 3143 | tcon->nativeFileSystem = |
| 3144 | kcalloc(1, length + 2, GFP_KERNEL); | 3144 | kzalloc(length + 2, GFP_KERNEL); |
| 3145 | cifs_strfromUCS_le(tcon->nativeFileSystem, | 3145 | cifs_strfromUCS_le(tcon->nativeFileSystem, |
| 3146 | (wchar_t *) bcc_ptr, | 3146 | (wchar_t *) bcc_ptr, |
| 3147 | length, nls_codepage); | 3147 | length, nls_codepage); |
| @@ -3159,7 +3159,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
| 3159 | if(tcon->nativeFileSystem) | 3159 | if(tcon->nativeFileSystem) |
| 3160 | kfree(tcon->nativeFileSystem); | 3160 | kfree(tcon->nativeFileSystem); |
| 3161 | tcon->nativeFileSystem = | 3161 | tcon->nativeFileSystem = |
| 3162 | kcalloc(1, length + 1, GFP_KERNEL); | 3162 | kzalloc(length + 1, GFP_KERNEL); |
| 3163 | strncpy(tcon->nativeFileSystem, bcc_ptr, | 3163 | strncpy(tcon->nativeFileSystem, bcc_ptr, |
| 3164 | length); | 3164 | length); |
| 3165 | } | 3165 | } |
| @@ -3215,10 +3215,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
| 3215 | } | 3215 | } |
| 3216 | 3216 | ||
| 3217 | cifs_sb->tcon = NULL; | 3217 | cifs_sb->tcon = NULL; |
| 3218 | if (ses) { | 3218 | if (ses) |
| 3219 | set_current_state(TASK_INTERRUPTIBLE); | 3219 | schedule_timeout_interruptible(msecs_to_jiffies(500)); |
| 3220 | schedule_timeout(HZ / 2); | ||
| 3221 | } | ||
| 3222 | if (ses) | 3220 | if (ses) |
| 3223 | sesInfoFree(ses); | 3221 | sesInfoFree(ses); |
| 3224 | 3222 | ||
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 3f3538d4a1fa..d335269bd91c 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -145,24 +145,23 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
| 145 | return -ENOMEM; | 145 | return -ENOMEM; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | if(nd) { | 148 | if(nd && (nd->flags & LOOKUP_OPEN)) { |
| 149 | if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY) | 149 | int oflags = nd->intent.open.flags; |
| 150 | desiredAccess = GENERIC_READ; | 150 | |
| 151 | else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) { | 151 | desiredAccess = 0; |
| 152 | desiredAccess = GENERIC_WRITE; | 152 | if (oflags & FMODE_READ) |
| 153 | write_only = TRUE; | 153 | desiredAccess |= GENERIC_READ; |
| 154 | } else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) { | 154 | if (oflags & FMODE_WRITE) { |
| 155 | /* GENERIC_ALL is too much permission to request */ | 155 | desiredAccess |= GENERIC_WRITE; |
| 156 | /* can cause unnecessary access denied on create */ | 156 | if (!(oflags & FMODE_READ)) |
| 157 | /* desiredAccess = GENERIC_ALL; */ | 157 | write_only = TRUE; |
| 158 | desiredAccess = GENERIC_READ | GENERIC_WRITE; | ||
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | 160 | if((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) |
| 162 | disposition = FILE_CREATE; | 161 | disposition = FILE_CREATE; |
| 163 | else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) | 162 | else if((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC)) |
| 164 | disposition = FILE_OVERWRITE_IF; | 163 | disposition = FILE_OVERWRITE_IF; |
| 165 | else if((nd->intent.open.flags & O_CREAT) == O_CREAT) | 164 | else if((oflags & O_CREAT) == O_CREAT) |
| 166 | disposition = FILE_OPEN_IF; | 165 | disposition = FILE_OPEN_IF; |
| 167 | else { | 166 | else { |
| 168 | cFYI(1,("Create flag not set in create function")); | 167 | cFYI(1,("Create flag not set in create function")); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 30ab70ce5547..3497125189df 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -643,7 +643,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
| 643 | netfid, length, | 643 | netfid, length, |
| 644 | pfLock->fl_start, numUnlock, numLock, lockType, | 644 | pfLock->fl_start, numUnlock, numLock, lockType, |
| 645 | wait_flag); | 645 | wait_flag); |
| 646 | if (rc == 0 && (pfLock->fl_flags & FL_POSIX)) | 646 | if (pfLock->fl_flags & FL_POSIX) |
| 647 | posix_lock_file_wait(file, pfLock); | 647 | posix_lock_file_wait(file, pfLock); |
| 648 | FreeXid(xid); | 648 | FreeXid(xid); |
| 649 | return rc; | 649 | return rc; |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index bde0fabfece0..ab925ef4f863 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
| @@ -92,7 +92,7 @@ cifs_hl_exit: | |||
| 92 | return rc; | 92 | return rc; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | int | 95 | void * |
| 96 | cifs_follow_link(struct dentry *direntry, struct nameidata *nd) | 96 | cifs_follow_link(struct dentry *direntry, struct nameidata *nd) |
| 97 | { | 97 | { |
| 98 | struct inode *inode = direntry->d_inode; | 98 | struct inode *inode = direntry->d_inode; |
| @@ -148,7 +148,7 @@ out: | |||
| 148 | out_no_free: | 148 | out_no_free: |
| 149 | FreeXid(xid); | 149 | FreeXid(xid); |
| 150 | nd_set_link(nd, target_path); | 150 | nd_set_link(nd, target_path); |
| 151 | return 0; | 151 | return NULL; /* No cookie */ |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | int | 154 | int |
| @@ -330,7 +330,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
| 330 | return rc; | 330 | return rc; |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | void cifs_put_link(struct dentry *direntry, struct nameidata *nd) | 333 | void cifs_put_link(struct dentry *direntry, struct nameidata *nd, void *cookie) |
| 334 | { | 334 | { |
| 335 | char *p = nd_get_link(nd); | 335 | char *p = nd_get_link(nd); |
| 336 | if (!IS_ERR(p)) | 336 | if (!IS_ERR(p)) |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 072b4ee8c53e..20ae4153f791 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
| @@ -611,6 +611,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen, | |||
| 611 | src_char = source[i]; | 611 | src_char = source[i]; |
| 612 | switch (src_char) { | 612 | switch (src_char) { |
| 613 | case 0: | 613 | case 0: |
| 614 | target[j] = 0; | ||
| 614 | goto ctoUCS_out; | 615 | goto ctoUCS_out; |
| 615 | case ':': | 616 | case ':': |
| 616 | target[j] = cpu_to_le16(UNI_COLON); | 617 | target[j] = cpu_to_le16(UNI_COLON); |
