Merge tag 'spi-v3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
[firefly-linux-kernel-4.4.55.git] / net / ceph / messenger.c
index 30efc5c186222c64ea3d7d21b194f8ce9f4e0f47..4f55f9ce63fac652f789353c6c3dc6f0e932951b 100644 (file)
@@ -919,6 +919,9 @@ static bool ceph_msg_data_pages_advance(struct ceph_msg_data_cursor *cursor,
        if (!bytes || cursor->page_offset)
                return false;   /* more bytes to process in the current page */
 
+       if (!cursor->resid)
+               return false;   /* no more data */
+
        /* Move on to the next page; offset is already at 0 */
 
        BUG_ON(cursor->page_index >= cursor->page_count);
@@ -1004,6 +1007,9 @@ static bool ceph_msg_data_pagelist_advance(struct ceph_msg_data_cursor *cursor,
        if (!bytes || cursor->offset & ~PAGE_MASK)
                return false;   /* more bytes to process in the current page */
 
+       if (!cursor->resid)
+               return false;   /* no more data */
+
        /* Move on to the next page */
 
        BUG_ON(list_is_last(&cursor->page->lru, &pagelist->head));