aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNathan Scott <nathans@oss.sgi.com>2004-12-19 04:18:34 -0800
committerNathan Scott <nathans@oss.sgi.com>2004-12-19 04:18:34 -0800
commitf34a152b970f9f705327d0ec4595b07c0d31c311 (patch)
tree60463aba71dfd5659144b21791b5e26bcbfd4669 /fs
parent5631f6835d554295bb7d182ad9596b1a07c229bd (diff)
parent6484567f9f24417999208f2fbb018be555b1d810 (diff)
downloadhistory-f34a152b970f9f705327d0ec4595b07c0d31c311.tar.gz
Merge bk://linux.bkbits.net/linux-2.5
into oss.sgi.com:/oss3/bitkeeper/xfs-linux-2.6
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/CHANGES7
-rw-r--r--fs/cifs/README7
-rw-r--r--fs/cifs/cifsfs.c8
-rw-r--r--fs/cifs/cifssmb.c133
-rw-r--r--fs/cifs/connect.c19
-rw-r--r--fs/cifs/file.c6
-rw-r--r--fs/cifs/inode.c10
-rw-r--r--fs/cifs/netmisc.c3
8 files changed, 113 insertions, 80 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 0e63f6b7c82e6d..4aaceb3733ed99 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -2,7 +2,12 @@ Version 1.28
------------
Add module init parm for large SMB buffer size (to allow it to be changed
from its default of 16K) which is especially useful for large file copy
-when mounting with the directio mount option.
+when mounting with the directio mount option. Fix oops after
+returning from mount when experimental ExtendedSecurity enabled and
+SpnegoNegotiated returning invalid error. Fix case to retry better when
+peek returns from 1 to 3 bytes on socket which should have more data.
+Fixed path based calls (such as cifs lookup) to handle path names
+longer than 530 (now can handle PATH_MAX).
Version 1.27
------------
diff --git a/fs/cifs/README b/fs/cifs/README
index 50ba63b60a918c..1643ef5426cc90 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -64,6 +64,13 @@ trivially built from Samba 3.0 or later source e.g. by executing:
gcc samba/source/client/mount.cifs.c -o mount.cifs
+If cifs is built as a module, then the size and number of network buffers
+and maximum number of simultaneous requests to one server can be configured.
+Changing these from their defaults is not recommended. By executing modinfo
+ modinfo kernel/fs/cifs/cifs.ko
+on kernel/fs/cifs/cifs.ko the list of configuration changes that can be made
+at module initialization time (by running insmod cifs.ko) can be seen.
+
Allowing User Mounts
====================
To permit users to mount and unmount over directories they own is possible
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 6e506620028af5..8de4890ca1ae81 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -60,7 +60,7 @@ unsigned int sign_CIFS_PDUs = 1;
struct task_struct * oplockThread = NULL;
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
module_param(CIFSMaxBufSize, int, CIFS_MAX_MSGSIZE);
-MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 4096 to 130048");
+MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 8192 to 130048");
unsigned int cifs_min_rcv = CIFS_MIN_RCV_POOL;
module_param(cifs_min_rcv, int, CIFS_MIN_RCV_POOL);
MODULE_PARM_DESC(cifs_min_rcv,"Network buffers in pool. Default: 4 Range: 1 to 64");
@@ -632,8 +632,10 @@ cifs_destroy_inodecache(void)
static int
cifs_init_request_bufs(void)
{
- if(CIFSMaxBufSize < 4096) {
- CIFSMaxBufSize = 4096;
+ if(CIFSMaxBufSize < 8192) {
+ /* Buffer size can not be smaller than 2 * PATH_MAX since maximum
+ Unicode path name has to fit in any SMB/CIFS path based frames */
+ CIFSMaxBufSize = 8192;
} else if (CIFSMaxBufSize > 1024*127) {
CIFSMaxBufSize = 1024 * 127;
} else {
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 4bed8119929e17..81a6c9ebda6ad2 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -389,6 +389,12 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
SecurityBlob,
count - 16,
&server->secType);
+ if(rc == 1) {
+ /* BB Need to fill struct for sessetup here */
+ rc = -EOPNOTSUPP;
+ } else {
+ rc = -EINVAL;
+ }
}
} else
server->capabilities &= ~CAP_EXTENDED_SECURITY;
@@ -547,13 +553,13 @@ DelFileRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->fileName, fileName, name_len);
}
@@ -599,13 +605,13 @@ RmDirRetry:
return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
- name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, 530
+ name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(dirName, 530);
+ name_len = strnlen(dirName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->DirName, dirName, name_len);
}
@@ -649,13 +655,13 @@ MkDirRetry:
return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
- name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, 530
+ name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(name, 530);
+ name_len = strnlen(name, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->DirName, name, name_len);
}
@@ -706,7 +712,7 @@ openRetry:
count = 1; /* account for one byte pad to word boundary */
name_len =
cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1),
- fileName, 530
+ fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
@@ -714,7 +720,7 @@ openRetry:
pSMB->NameLength = cpu_to_le16(name_len);
} else { /* BB improve the check for buffer overruns BB */
count = 0; /* no pad */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
pSMB->NameLength = cpu_to_le16(name_len);
strncpy(pSMB->fileName, fileName, name_len);
@@ -1113,7 +1119,7 @@ renameRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
@@ -1123,15 +1129,15 @@ renameRetry:
pSMB->OldFileName[name_len + 1] = 0x00;
name_len2 =
cifs_strtoUCS((wchar_t *) & pSMB->
- OldFileName[name_len + 2], toName, 530,
+ OldFileName[name_len + 2], toName, PATH_MAX,
nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fromName, 530);
+ name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len);
- name_len2 = strnlen(toName, 530);
+ name_len2 = strnlen(toName, PATH_MAX);
name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
@@ -1212,7 +1218,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid);
len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, dummy_string, 24, nls_codepage);
} else {
- len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage);
+ len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, PATH_MAX, nls_codepage);
}
rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2;
@@ -1271,7 +1277,7 @@ copyRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName,
fromName,
- 530 /* find define for this maxpathcomponent */,
+ PATH_MAX /* find define for this maxpathcomponent */,
nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
@@ -1279,15 +1285,15 @@ copyRetry:
/* protocol requires ASCII signature byte on Unicode string */
pSMB->OldFileName[name_len + 1] = 0x00;
name_len2 = cifs_strtoUCS((wchar_t *) & pSMB->
- OldFileName[name_len + 2], toName, 530,
+ OldFileName[name_len + 2], toName, PATH_MAX,
nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fromName, 530);
+ name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len);
- name_len2 = strnlen(toName, 530);
+ name_len2 = strnlen(toName, PATH_MAX);
name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
@@ -1337,14 +1343,14 @@ createSymLinkRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fromName, 530);
+ name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fromName, name_len);
}
@@ -1361,13 +1367,13 @@ createSymLinkRetry:
data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len_target =
- cifs_strtoUCS((wchar_t *) data_offset, toName, 530
+ cifs_strtoUCS((wchar_t *) data_offset, toName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len_target++; /* trailing null */
name_len_target *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len_target = strnlen(toName, 530);
+ name_len_target = strnlen(toName, PATH_MAX);
name_len_target++; /* trailing null */
strncpy(data_offset, toName, name_len_target);
}
@@ -1428,14 +1434,14 @@ createHardLinkRetry:
return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
- name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, 530
+ name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(toName, 530);
+ name_len = strnlen(toName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, toName, name_len);
}
@@ -1452,13 +1458,13 @@ createHardLinkRetry:
data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len_target =
- cifs_strtoUCS((wchar_t *) data_offset, fromName, 530
+ cifs_strtoUCS((wchar_t *) data_offset, fromName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len_target++; /* trailing null */
name_len_target *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len_target = strnlen(fromName, 530);
+ name_len_target = strnlen(fromName, PATH_MAX);
name_len_target++; /* trailing null */
strncpy(data_offset, fromName, name_len_target);
}
@@ -1524,7 +1530,7 @@ winCreateHardLinkRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
@@ -1533,15 +1539,15 @@ winCreateHardLinkRetry:
pSMB->OldFileName[name_len + 1] = 0x04;
name_len2 =
cifs_strtoUCS((wchar_t *) & pSMB->
- OldFileName[name_len + 2], toName, 530,
+ OldFileName[name_len + 2], toName, PATH_MAX,
nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fromName, 530);
+ name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len);
- name_len2 = strnlen(toName, 530);
+ name_len2 = strnlen(toName, PATH_MAX);
name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
@@ -1590,13 +1596,13 @@ querySymLinkRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -1906,7 +1912,7 @@ queryAclRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* BB fixme find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
@@ -1914,7 +1920,7 @@ queryAclRetry:
pSMB->FileName[name_len] = 0;
pSMB->FileName[name_len+1] = 0;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530 /* BB fixme */);
+ name_len = strnlen(searchName, PATH_MAX /* BB fixme */);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -1992,13 +1998,13 @@ setAclRetry:
return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* BB fixme find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len);
}
@@ -2075,13 +2081,13 @@ QPathInfoRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -2158,13 +2164,13 @@ UnixQPathInfoRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -2242,13 +2248,13 @@ findUniqueRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -2325,13 +2331,13 @@ findFirstRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -2586,7 +2592,7 @@ int CIFSFindNext2(const int xid, struct cifsTconInfo *tcon,
cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO);
psrch_inf->info_level = SMB_FIND_FILE_DIRECTORY_INFO;
} */
- pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
+ pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
pSMB->ResumeKey = psrch_inf->resume_key;
pSMB->SearchFlags =
cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME);
@@ -2876,13 +2882,13 @@ getDFSRetry:
pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
name_len =
cifs_strtoUCS((wchar_t *) pSMB->RequestFileName,
- searchName, 530
+ searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->RequestFileName, searchName, name_len);
}
@@ -3329,13 +3335,13 @@ SetEOFRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len);
}
@@ -3508,13 +3514,13 @@ SetTimesRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len);
}
@@ -3588,13 +3594,13 @@ SetTimesRetryLegacy:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len);
}
@@ -3624,12 +3630,7 @@ SetTimesRetryLegacy:
pSMB->ParameterCount = cpu_to_le16(params);
pSMB->TotalDataCount = pSMB->DataCount;
pSMB->TotalParameterCount = pSMB->ParameterCount;
- /* I doubt that passthrough levels apply to this old
- preNT info level */
-/* if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)
- pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
- else*/
- pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
+ pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
pSMB->Reserved4 = 0;
pSMB->hdr.smb_buf_length += byte_count;
memcpy(data_offset, data, sizeof (FILE_INFO_STANDARD));
@@ -3671,13 +3672,13 @@ setPermsRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len);
}
@@ -3820,13 +3821,13 @@ QAllEAsRetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -3964,13 +3965,13 @@ QEARetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(searchName, 530);
+ name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len);
}
@@ -4111,13 +4112,13 @@ SetEARetry:
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
- cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+ cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */
- name_len = strnlen(fileName, 530);
+ name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len);
}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 018ee5af160e44..24bd15572009a2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -254,7 +254,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
cFYI(1,("call to reconnect done"));
csocket = server->ssocket;
continue;
- } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) {
+ } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)
+ || ((length > 0) && (length <= 3)) ) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1); /* minimum sleep to prevent looping
allowing socket to clear and app threads to set
@@ -280,7 +281,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
}
pdu_length = 4 + ntohl(smb_buffer->smb_buf_length);
- /* Ony read pdu_length after below checks for too short (due
+ /* Only read pdu_length after below checks for too short (due
to e.g. int overflow) and too long ie beyond end of buf */
cFYI(1, ("Peek length rcvd: 0x%x beginning 0x%x)", length, pdu_length));
@@ -330,13 +331,19 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
csocket = server->ssocket;
continue;
} else {
- if (/*(length != sizeof (struct smb_hdr) - 1)
- ||*/ (pdu_length >
+ if (length < 16) {
+ /* We can not validate the SMB unless
+ at least this much of SMB available
+ so give the socket time to copy
+ a few more bytes and retry */
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(10);
+ continue;
+ } else if( (pdu_length >
CIFSMaxBufSize + MAX_CIFS_HDR_SIZE)
|| (pdu_length <
sizeof (struct smb_hdr) - 1)
- ||
- (checkSMBhdr
+ || (checkSMBhdr
(smb_buffer, smb_buffer->Mid))) {
cERROR(1,
("Invalid size or format for SMB found with length %d and pdu_length %d",
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index fb5eb6eed6ed81..6356b66db9cc0e 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -64,7 +64,7 @@ cifs_open(struct inode *inode, struct file *file)
read_lock(&GlobalSMBSeslock);
list_for_each(tmp, &pCifsInode->openFileList) {
pCifsFile = list_entry(tmp,struct cifsFileInfo, flist);
- if((pCifsFile->pfile == NULL)&& (pCifsFile->pid = current->pid)){
+ if((pCifsFile->pfile == NULL)&& (pCifsFile->pid == current->tgid)){
/* mode set in cifs_create */
pCifsFile->pfile = file; /* needed for writepage */
file->private_data = pCifsFile;
@@ -168,7 +168,7 @@ cifs_open(struct inode *inode, struct file *file)
memset(file->private_data, 0, sizeof(struct cifsFileInfo));
pCifsFile = (struct cifsFileInfo *) file->private_data;
pCifsFile->netfid = netfid;
- pCifsFile->pid = current->pid;
+ pCifsFile->pid = current->tgid;
init_MUTEX(&pCifsFile->fh_sem);
pCifsFile->pfile = file; /* needed for writepage */
pCifsFile->pInode = inode;
@@ -598,7 +598,7 @@ cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
pfLock->fl_start, numUnlock, numLock, lockType,
wait_flag);
if (rc == 0 && (pfLock->fl_flags & FL_POSIX))
- posix_lock_file(file, pfLock);
+ posix_lock_file_wait(file, pfLock);
FreeXid(xid);
return rc;
}
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index aa84db7e2c9eda..319925079afa05 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -980,6 +980,16 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs)
via Handle (SetFileInfo) instead of by path */
rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf,
cifs_sb->local_nls);
+ if(rc == -EOPNOTSUPP) {
+ cFYI(1,("OS2 level of SetPathInfo not implemented"));
+ /* Need to convert time_buf into old format,
+ but probably better to do that inside the function
+ below rather than here */
+ /* Better to return EOPNOTSUPP until function
+ below is ready */
+ /* CIFSSMBSetTimesLegacy(xid, pTcon, full_path,
+ FILE_INFO_STANDARD * data, cifs_sb->local_nls); */
+ }
}
/* do not need local check to inode_check_ok since the server does that */
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index ba22947d39aaee..b1f5248363e93c 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -754,7 +754,8 @@ static const struct {
ERRDOS, ERRnoaccess, 0xc000028e}, {
ERRDOS, ERRnoaccess, 0xc000028f}, {
ERRDOS, ERRnoaccess, 0xc0000290}, {
-ERRDOS, ERRbadfunc, 0xc000029c},};
+ ERRDOS, ERRbadfunc, 0xc000029c}, {
+ ERRDOS, ERRinvlevel, 0x007c0001}, };
/*****************************************************************************
Print an error message from the status code