cifs: fix length vs. total_read confusion in cifs_demultiplex_thread
authorJeff Layton <jlayton@redhat.com>
Tue, 1 Feb 2011 13:40:43 +0000 (08:40 -0500)
committerSteve French <sfrench@us.ibm.com>
Wed, 2 Feb 2011 00:17:04 +0000 (00:17 +0000)
length at this point is the length returned by the last kernel_recvmsg
call. total_read is the length of all of the data read so far. length
is more or less meaningless at this point, so use total_read for
everything.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/connect.c

index 47d8ff623683524a4a264e7317a8e707a5a209ed..945b2202275fc69e4080d7ebd6a9f4d70cc00724 100644 (file)
@@ -578,12 +578,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;
                }