summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2011-02-08 23:52:32 +0000
committerSteve French <sfrench@us.ibm.com>2011-02-08 23:52:32 +0000
commit7e90d705fc9f8c5e3a1549281dce0654d049243b (patch)
tree36752aa5c1005716d2ce91cbf020ab8c2602f129 /fs/cifs
parent100b33c8bd8a3235fd0b7948338d6cbb3db3c63d (diff)
downloadkernel-mfld-blackbay-7e90d705fc9f8c5e3a1549281dce0654d049243b.tar.gz
kernel-mfld-blackbay-7e90d705fc9f8c5e3a1549281dce0654d049243b.tar.bz2
kernel-mfld-blackbay-7e90d705fc9f8c5e3a1549281dce0654d049243b.zip
[CIFS] Do not send SMBEcho requests on new sockets until SMBNegotiate
In order to determine whether an SMBEcho request can be sent we need to know that the socket is established (server tcpStatus == CifsGood) AND that an SMB NegotiateProtocol has been sent (server maxBuf != 0). Without the second check we can send an Echo request during reconnection before the server can accept it. CC: JG <jg@cms.ac> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsglob.h2
-rw-r--r--fs/cifs/connect.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index edd5b29b53c..1ab33eb71d9 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -188,6 +188,8 @@ struct TCP_Server_Info {
/* multiplexed reads or writes */
unsigned int maxBuf; /* maxBuf specifies the maximum */
/* message size the server can send or receive for non-raw SMBs */
+ /* maxBuf is returned by SMB NegotiateProtocol so maxBuf is only 0 */
+ /* when socket is setup (and during reconnect) before NegProt sent */
unsigned int max_rw; /* maxRw specifies the maximum */
/* message size the server can send or receive for */
/* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 257b6d895e2..10011e99b34 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -341,7 +341,7 @@ cifs_echo_request(struct work_struct *work)
* We cannot send an echo until the NEGOTIATE_PROTOCOL request is done.
* Also, no need to ping if we got a response recently
*/
- if (server->tcpStatus != CifsGood ||
+ if ((server->tcpStatus != CifsGood) || (server->maxBuf == 0) ||
time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
goto requeue_echo;