afs: Fix an off-by-one error in afs_send_pages()
authorDavid Howells <dhowells@redhat.com>
Thu, 16 Mar 2017 16:27:48 +0000 (16:27 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 16 Mar 2017 16:29:30 +0000 (16:29 +0000)
afs_send_pages() should only put the call into the AFS_CALL_AWAIT_REPLY
state if it has sent all the pages - but the check it makes is incorrect
and sometimes it will finish the loop early.

Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/rxrpc.c

index 22d26b3690709b2aa11176996b595f90cfaf44df..b12da6aa54129b2398e9454c1a9a45b6289d946d 100644 (file)
@@ -315,7 +315,7 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
                 * packet as RxRPC might give us the reply before it
                 * returns from sending the request.
                 */
-               if (first + nr >= last)
+               if (first + nr - 1 >= last)
                        call->state = AFS_CALL_AWAIT_REPLY;
                ret = rxrpc_kernel_send_data(afs_socket, call->rxcall,
                                             msg, bytes);