libcli/smb/smb_direct.c
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Oct 2016 06:25:16 +0000 (08:25 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:19 +0000 (14:35 +0200)
libcli/smb/smb_direct.c

index 4b309a3b9551a2ac60ad24edbc353dd5f4d992e6..762c06989733caa98f9d455c21f6ff61fdfd6c4e 100644 (file)
@@ -2127,7 +2127,8 @@ static void smb_direct_connection_ibv_handler(struct tevent_context *ev,
        struct ibv_wc wc;
        int ret;
        uint16_t credits_requested;
-       uint32_t credits_granted;
+       uint16_t credits_granted;
+       uint32_t send_credits;
        uint16_t flags;
        uint32_t data_offset;
        struct smb_direct_io *io = NULL;
@@ -2271,15 +2272,18 @@ try_again:
                c->state.receive_credits -= 1;
                c->state.receive_credit_target = credits_requested;
 
-               credits_granted += c->state.send_credits;
-               if (credits_granted > c->state.send_credit_target) {
+               send_credits = c->state.send_credits + credits_granted;
+               if (send_credits > c->state.send_credit_target) {
+smb_direct_connection_debug_credits(c, "wrong RECV",io, __location__, __func__);
                        status = NT_STATUS_INVALID_NETWORK_RESPONSE;
-                       DEBUG(0,("%s:%s: ret[%d] errno[%d] status[%s]\n",
-                               __location__, __FUNCTION__, ret, errno, nt_errstr(status)));
+                       DEBUG(0,("%s:%s: credits_granted[%u] send_credits[%u] ret[%d] errno[%d] status[%s]\n",
+                               __location__, __FUNCTION__,
+                               (unsigned)credits_granted, (unsigned)send_credits,
+                               ret, errno, nt_errstr(status)));
                        smb_direct_connection_disconnect(c, status);
                        return;
                }
-               c->state.send_credits = credits_granted;
+               c->state.send_credits = send_credits;
 
                smb_direct_connection_debug_credits(c, "GOT_RECV", io, __location__, __FUNCTION__);