Skip to content

Commit

Permalink
libceph: fix oops in ceph_msg_data_{pages,pagelist}_advance()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yan, Zheng authored and Sage Weil committed Apr 5, 2014
1 parent 5f75ce5 commit d90deda
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit d90deda

Please sign in to comment.