Commit 7376e39a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ceph-for-5.1-rc3' of git://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
 "A patch to avoid choking on multipage bvecs in the messenger and a
  small use-after-free fix"

* tag 'ceph-for-5.1-rc3' of git://github.com/ceph/ceph-client:
  ceph: fix use-after-free on symlink traversal
  libceph: fix breakage caused by multipage bvecs
parents c6503f12 daf5cc27
...@@ -524,6 +524,7 @@ static void ceph_i_callback(struct rcu_head *head) ...@@ -524,6 +524,7 @@ static void ceph_i_callback(struct rcu_head *head)
struct inode *inode = container_of(head, struct inode, i_rcu); struct inode *inode = container_of(head, struct inode, i_rcu);
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
kfree(ci->i_symlink);
kmem_cache_free(ceph_inode_cachep, ci); kmem_cache_free(ceph_inode_cachep, ci);
} }
...@@ -566,7 +567,6 @@ void ceph_destroy_inode(struct inode *inode) ...@@ -566,7 +567,6 @@ void ceph_destroy_inode(struct inode *inode)
} }
} }
kfree(ci->i_symlink);
while ((n = rb_first(&ci->i_fragtree)) != NULL) { while ((n = rb_first(&ci->i_fragtree)) != NULL) {
frag = rb_entry(n, struct ceph_inode_frag, node); frag = rb_entry(n, struct ceph_inode_frag, node);
rb_erase(n, &ci->i_fragtree); rb_erase(n, &ci->i_fragtree);
......
...@@ -840,6 +840,7 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor, ...@@ -840,6 +840,7 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor,
size_t bytes) size_t bytes)
{ {
struct ceph_bio_iter *it = &cursor->bio_iter; struct ceph_bio_iter *it = &cursor->bio_iter;
struct page *page = bio_iter_page(it->bio, it->iter);
BUG_ON(bytes > cursor->resid); BUG_ON(bytes > cursor->resid);
BUG_ON(bytes > bio_iter_len(it->bio, it->iter)); BUG_ON(bytes > bio_iter_len(it->bio, it->iter));
...@@ -851,7 +852,8 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor, ...@@ -851,7 +852,8 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor,
return false; /* no more data */ return false; /* no more data */
} }
if (!bytes || (it->iter.bi_size && it->iter.bi_bvec_done)) if (!bytes || (it->iter.bi_size && it->iter.bi_bvec_done &&
page == bio_iter_page(it->bio, it->iter)))
return false; /* more bytes to process in this segment */ return false; /* more bytes to process in this segment */
if (!it->iter.bi_size) { if (!it->iter.bi_size) {
...@@ -899,6 +901,7 @@ static bool ceph_msg_data_bvecs_advance(struct ceph_msg_data_cursor *cursor, ...@@ -899,6 +901,7 @@ static bool ceph_msg_data_bvecs_advance(struct ceph_msg_data_cursor *cursor,
size_t bytes) size_t bytes)
{ {
struct bio_vec *bvecs = cursor->data->bvec_pos.bvecs; struct bio_vec *bvecs = cursor->data->bvec_pos.bvecs;
struct page *page = bvec_iter_page(bvecs, cursor->bvec_iter);
BUG_ON(bytes > cursor->resid); BUG_ON(bytes > cursor->resid);
BUG_ON(bytes > bvec_iter_len(bvecs, cursor->bvec_iter)); BUG_ON(bytes > bvec_iter_len(bvecs, cursor->bvec_iter));
...@@ -910,7 +913,8 @@ static bool ceph_msg_data_bvecs_advance(struct ceph_msg_data_cursor *cursor, ...@@ -910,7 +913,8 @@ static bool ceph_msg_data_bvecs_advance(struct ceph_msg_data_cursor *cursor,
return false; /* no more data */ return false; /* no more data */
} }
if (!bytes || cursor->bvec_iter.bi_bvec_done) if (!bytes || (cursor->bvec_iter.bi_bvec_done &&
page == bvec_iter_page(bvecs, cursor->bvec_iter)))
return false; /* more bytes to process in this segment */ return false; /* more bytes to process in this segment */
BUG_ON(cursor->last_piece); BUG_ON(cursor->last_piece);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment