diff options
author | Steve French <stevef@smfhome.smfdom> | 2004-12-14 03:31:18 -0600 |
---|---|---|
committer | Steve French <stevef@smfhome.smfdom> | 2004-12-14 03:31:18 -0600 |
commit | 071d001e8fffd4a55959f55e9a5933d88323d2a4 (patch) | |
tree | cce4109be068713f7740b1cbef6956ce9568fd36 /fs | |
parent | 37658b57a1f476cca74ca579332b7ba84bc689b7 (diff) | |
download | history-071d001e8fffd4a55959f55e9a5933d88323d2a4.tar.gz |
return the right return code on failed ExtendedSecurity mount to SPNEGO enabled
servers to avoid mount oops. Fix case in which tcp stack only returns 3 bytes
of larger peek of smb header (which would otherwise kill the
session and cause us to have to reconnect)
Signed-of-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/CHANGES | 5 | ||||
-rw-r--r-- | fs/cifs/README | 7 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 6 | ||||
-rw-r--r-- | fs/cifs/connect.c | 19 | ||||
-rw-r--r-- | fs/cifs/file.c | 7 |
5 files changed, 34 insertions, 10 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 0e63f6b7c82e6d..7a2c8cf45a90ac 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES @@ -2,7 +2,10 @@ 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. 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/cifssmb.c b/fs/cifs/cifssmb.c index 4bed8119929e17..32a3a6905f1e2c 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; 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..65990e0655a50a 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,8 @@ 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); + if(experimEnabled) + posix_lock_file(file, pfLock); FreeXid(xid); return rc; } |