From: Pavel Shilovsky <[email protected]>

Signed-off-by: Pavel Shilovsky <[email protected]>
---
 fs/cifs/connect.c |   19 +++++++++++++++++--
 fs/cifs/nterr.h   |    1 +
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ab9e972..e46c2bd 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -825,10 +825,10 @@ standard_receive3(struct TCP_Server_Info *server, struct 
mid_q_entry *mid)
         * into the payload for debugging purposes.
         */
 #ifdef CONFIG_CIFS_SMB2
-       if (server->is_smb2)
+       if (server->is_smb2) {
                length = checkSMB2(smb2_buffer, smb2_buffer->MessageId,
                                   server->total_read);
-       else
+       } else
 #endif
                length = checkSMB(smb_buffer, smb_buffer->Mid,
                                  server->total_read);
@@ -836,6 +836,21 @@ standard_receive3(struct TCP_Server_Info *server, struct 
mid_q_entry *mid)
                cifs_dump_mem("Bad SMB: ", buf,
                        min_t(unsigned int, server->total_read, 48));
 
+#ifdef CONFIG_CIFS_SMB2
+       /*
+       * If we negotiate SMB2 protocol and get STATUS_PENDING - update
+       * the number of credits and skip it.
+       */
+       if (server->is_smb2 &&
+                       le32_to_cpu(smb2_buffer->Status) == STATUS_PENDING) {
+               if (!length)
+                       atomic_add(le16_to_cpu(smb2_buffer->CreditRequest),
+                                  &server->credits);
+               cERROR(1, "STATUS PENDING");
+               return -1;
+       }
+#endif
+
        if (mid)
                handle_mid(mid, server, buf, length);
 
diff --git a/fs/cifs/nterr.h b/fs/cifs/nterr.h
index 2572673..e80c0ef 100644
--- a/fs/cifs/nterr.h
+++ b/fs/cifs/nterr.h
@@ -40,6 +40,7 @@ extern const struct nt_err_code_struct nt_errs[];
 #define ERROR_INSUFFICIENT_BUFFER        0x007a
 #define STATUS_1804                      0x070c
 #define STATUS_NOTIFY_ENUM_DIR            0x010c
+#define STATUS_PENDING                   0x00000103
 
 /* Win32 Error codes extracted using a loop in smbclient then printing a
    netmon sniff to a file. */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to