When pinning memory failed, we should return the correct error code and
rewind the SMB credits.
Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Long Li <longli@microsoft.com>
Cc: stable@vger.kernel.org
Cc: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
                                        result, from->type,
                                        from->iov_offset, from->count);
                                dump_stack();
+
+                               rc = result;
+                               add_credits_and_wake_if(server, credits, 0);
                                break;
                        }
                        cur_len = (size_t)result;
                                        cur_len, &start);
                        if (result < 0) {
                                cifs_dbg(VFS,
-                                       "couldn't get user pages (cur_len=%zd)"
+                                       "couldn't get user pages (rc=%zd)"
                                        " iter type %d"
                                        " iov_offset %zd count %zd\n",
                                        result, direct_iov.type,
                                        direct_iov.iov_offset,
                                        direct_iov.count);
                                dump_stack();
+
+                               rc = result;
+                               add_credits_and_wake_if(server, credits, 0);
                                break;
                        }
                        cur_len = (size_t)result;