Merge tag 'block-6.0-2022-09-16' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"Two fixes for -rc6:

- Fix a mixup of sectors and bytes in the secure erase ioctl
(Mikulas)

- Fix for a bad return value for a non-blocking bio/blk queue enter
call (me)"

* tag 'block-6.0-2022-09-16' of git://git.kernel.dk/linux-block:
blk-lib: fix blkdev_issue_secure_erase
block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for nowait

Changed files
+10 -5
block
+2 -2
block/blk-core.c
··· 295 295 296 296 while (!blk_try_enter_queue(q, pm)) { 297 297 if (flags & BLK_MQ_REQ_NOWAIT) 298 - return -EBUSY; 298 + return -EAGAIN; 299 299 300 300 /* 301 301 * read pair of barrier in blk_freeze_queue_start(), we need to ··· 325 325 if (test_bit(GD_DEAD, &disk->state)) 326 326 goto dead; 327 327 bio_wouldblock_error(bio); 328 - return -EBUSY; 328 + return -EAGAIN; 329 329 } 330 330 331 331 /*
+8 -3
block/blk-lib.c
··· 309 309 struct blk_plug plug; 310 310 int ret = 0; 311 311 312 + /* make sure that "len << SECTOR_SHIFT" doesn't overflow */ 313 + if (max_sectors > UINT_MAX >> SECTOR_SHIFT) 314 + max_sectors = UINT_MAX >> SECTOR_SHIFT; 315 + max_sectors &= ~bs_mask; 316 + 312 317 if (max_sectors == 0) 313 318 return -EOPNOTSUPP; 314 319 if ((sector | nr_sects) & bs_mask) ··· 327 322 328 323 bio = blk_next_bio(bio, bdev, 0, REQ_OP_SECURE_ERASE, gfp); 329 324 bio->bi_iter.bi_sector = sector; 330 - bio->bi_iter.bi_size = len; 325 + bio->bi_iter.bi_size = len << SECTOR_SHIFT; 331 326 332 - sector += len << SECTOR_SHIFT; 333 - nr_sects -= len << SECTOR_SHIFT; 327 + sector += len; 328 + nr_sects -= len; 334 329 if (!nr_sects) { 335 330 ret = submit_bio_wait(bio); 336 331 bio_put(bio);