]> git.karo-electronics.de Git - linux-beck.git/commitdiff
libceph: fix oops in ceph_msg_data_{pages,pagelist}_advance()
authorYan, Zheng <zheng.z.yan@intel.com>
Sat, 22 Mar 2014 22:50:39 +0000 (06:50 +0800)
committerSage Weil <sage@inktank.com>
Sat, 5 Apr 2014 04:07:15 +0000 (21:07 -0700)
When there is no more data, ceph_msg_data_{pages,pagelist}_advance()
should not move on to the next page.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
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));