Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: handle bio_split_to_limits() NULL return

This can't happen right now, but in preparation for allowing
bio_split_to_limits() returning NULL if it ended the bio, check for it
in all the callers.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+19 -2
+3 -1
block/blk-merge.c
··· 358 358 default: 359 359 split = bio_split_rw(bio, lim, nr_segs, bs, 360 360 get_max_io_size(bio, lim) << SECTOR_SHIFT); 361 + if (IS_ERR(split)) 362 + return NULL; 361 363 break; 362 364 } 363 365 364 366 if (split) { 365 - /* there isn't chance to merge the splitted bio */ 367 + /* there isn't chance to merge the split bio */ 366 368 split->bi_opf |= REQ_NOMERGE; 367 369 368 370 blkcg_bio_issue_init(split);
+4 -1
block/blk-mq.c
··· 2951 2951 blk_status_t ret; 2952 2952 2953 2953 bio = blk_queue_bounce(bio, q); 2954 - if (bio_may_exceed_limits(bio, &q->limits)) 2954 + if (bio_may_exceed_limits(bio, &q->limits)) { 2955 2955 bio = __bio_split_to_limits(bio, &q->limits, &nr_segs); 2956 + if (!bio) 2957 + return; 2958 + } 2956 2959 2957 2960 if (!bio_integrity_prep(bio)) 2958 2961 return;
+2
drivers/block/drbd/drbd_req.c
··· 1607 1607 struct drbd_device *device = bio->bi_bdev->bd_disk->private_data; 1608 1608 1609 1609 bio = bio_split_to_limits(bio); 1610 + if (!bio) 1611 + return; 1610 1612 1611 1613 /* 1612 1614 * what we "blindly" assume:
+2
drivers/block/ps3vram.c
··· 587 587 dev_dbg(&dev->core, "%s\n", __func__); 588 588 589 589 bio = bio_split_to_limits(bio); 590 + if (!bio) 591 + return; 590 592 591 593 spin_lock_irq(&priv->lock); 592 594 busy = !bio_list_empty(&priv->list);
+2
drivers/md/dm.c
··· 1742 1742 * otherwise associated queue_limits won't be imposed. 1743 1743 */ 1744 1744 bio = bio_split_to_limits(bio); 1745 + if (!bio) 1746 + return; 1745 1747 } 1746 1748 1747 1749 init_clone_info(&ci, md, map, bio, is_abnormal);
+2
drivers/md/md.c
··· 455 455 } 456 456 457 457 bio = bio_split_to_limits(bio); 458 + if (!bio) 459 + return; 458 460 459 461 if (mddev->ro == MD_RDONLY && unlikely(rw == WRITE)) { 460 462 if (bio_sectors(bio) != 0)
+2
drivers/nvme/host/multipath.c
··· 376 376 * pool from the original queue to allocate the bvecs from. 377 377 */ 378 378 bio = bio_split_to_limits(bio); 379 + if (!bio) 380 + return; 379 381 380 382 srcu_idx = srcu_read_lock(&head->srcu); 381 383 ns = nvme_find_path(head);
+2
drivers/s390/block/dcssblk.c
··· 865 865 unsigned long bytes_done; 866 866 867 867 bio = bio_split_to_limits(bio); 868 + if (!bio) 869 + return; 868 870 869 871 bytes_done = 0; 870 872 dev_info = bio->bi_bdev->bd_disk->private_data;