diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2014-03-23 06:50:39 +0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2014-04-04 21:07:15 -0700 |
commit | d90deda69cb82411ba7d990e97218e0f8b2d07bb (patch) | |
tree | c99d23f6ec67296c07dd661180c917b8cce2fad6 /net/ceph | |
parent | 5f75ce57818e4a48bdeac0b76daeb434eea26059 (diff) | |
download | linux-d90deda69cb82411ba7d990e97218e0f8b2d07bb.tar.gz linux-d90deda69cb82411ba7d990e97218e0f8b2d07bb.tar.bz2 linux-d90deda69cb82411ba7d990e97218e0f8b2d07bb.zip |
libceph: fix oops in ceph_msg_data_{pages,pagelist}_advance()
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>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/messenger.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 30efc5c18622..4f55f9ce63fa 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -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)); |