summaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-02-07 14:02:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-07 14:02:06 -0800
commit257a65d79581880032e0bf0c452f4041b693664c (patch)
tree4625bca70fab5ba4e40aff07700db90b08fadb0d /fs/cifs/connect.c
parent8dbdea8444d303a772bceb1ba963f0e3273bfc5e (diff)
parentd402539b8fc3fa21f16eb5e654be742670399e8a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: cifs: remove checks for ses->status == CifsExiting cifs: add check for kmalloc in parse_dacl cifs: don't send an echo request unless NegProt has been done cifs: enable signing flag in SMB header when server has it on cifs: Possible slab memory corruption while updating extended stats (repost) CIFS: Fix variable types in cifs_iovec_read/write (try #2) cifs: fix length vs. total_read confusion in cifs_demultiplex_thread
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 47d8ff62368..257b6d895e2 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -337,8 +337,12 @@ cifs_echo_request(struct work_struct *work)
struct TCP_Server_Info *server = container_of(work,
struct TCP_Server_Info, echo.work);
- /* no need to ping if we got a response recently */
- if (time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
+ /*
+ * 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 ||
+ time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
goto requeue_echo;
rc = CIFSSMBEcho(server);
@@ -578,12 +582,12 @@ incomplete_rcv:
else if (reconnect == 1)
continue;
- length += 4; /* account for rfc1002 hdr */
+ total_read += 4; /* account for rfc1002 hdr */
-
- dump_smb(smb_buffer, length);
- if (checkSMB(smb_buffer, smb_buffer->Mid, total_read+4)) {
- cifs_dump_mem("Bad SMB: ", smb_buffer, 48);
+ dump_smb(smb_buffer, total_read);
+ if (checkSMB(smb_buffer, smb_buffer->Mid, total_read)) {
+ cifs_dump_mem("Bad SMB: ", smb_buffer,
+ total_read < 48 ? total_read : 48);
continue;
}
@@ -633,11 +637,11 @@ incomplete_rcv:
mid_entry->largeBuf = isLargeBuf;
multi_t2_fnd:
mid_entry->midState = MID_RESPONSE_RECEIVED;
- list_del_init(&mid_entry->qhead);
- mid_entry->callback(mid_entry);
#ifdef CONFIG_CIFS_STATS2
mid_entry->when_received = jiffies;
#endif
+ list_del_init(&mid_entry->qhead);
+ mid_entry->callback(mid_entry);
break;
}
mid_entry = NULL;