Skip to content

Commit 0ec1d15

Browse files
idryomovSage Weil
authored andcommitted
libceph: do not dereference a NULL bio pointer
Commit f38a518 ("ceph: Convert to immutable biovecs") introduced a NULL pointer dereference, which broke rbd in -rc1. Fix it. Cc: Kent Overstreet <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Sage Weil <[email protected]>
1 parent ff513ac commit 0ec1d15

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/ceph/messenger.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,13 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor,
840840

841841
if (!cursor->bvec_iter.bi_size) {
842842
bio = bio->bi_next;
843-
cursor->bvec_iter = bio->bi_iter;
843+
cursor->bio = bio;
844+
if (bio)
845+
cursor->bvec_iter = bio->bi_iter;
846+
else
847+
memset(&cursor->bvec_iter, 0,
848+
sizeof(cursor->bvec_iter));
844849
}
845-
cursor->bio = bio;
846850

847851
if (!cursor->last_piece) {
848852
BUG_ON(!cursor->resid);

0 commit comments

Comments
 (0)