diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-04-05 17:04:11 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-04-05 17:04:11 -0700 |
commit | 8a05ef7087166d7fa0de986fb6a2d97850dbd551 (patch) | |
tree | cc12138c2d47f4791de26037107ef468901ff896 /block | |
parent | 4f72ed492d7798919269a20d157d34495a988935 (diff) | |
parent | 9d0e8524204484702234e972a7e9f3015080987c (diff) | |
download | linux-stable-8a05ef7087166d7fa0de986fb6a2d97850dbd551.tar.gz linux-stable-8a05ef7087166d7fa0de986fb6a2d97850dbd551.tar.bz2 linux-stable-8a05ef7087166d7fa0de986fb6a2d97850dbd551.zip |
Merge tag 'block-6.9-20240405' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe:
- NVMe pull request via Keith:
- Atomic queue limits fixes (Christoph)
- Fabrics fixes (Hannes, Daniel)
- Discard overflow fix (Li)
- Cleanup fix for null_blk (Damien)
* tag 'block-6.9-20240405' of git://git.kernel.dk/linux:
nvme-fc: rename free_ctrl callback to match name pattern
nvmet-fc: move RCU read lock to nvmet_fc_assoc_exists
nvmet: implement unique discovery NQN
nvme: don't create a multipath node for zero capacity devices
nvme: split nvme_update_zone_info
nvme-multipath: don't inherit LBA-related fields for the multipath node
block: fix overflow in blk_ioctl_discard()
nullblk: Fix cleanup order in null_add_dev() error path
Diffstat (limited to 'block')
-rw-r--r-- | block/ioctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index 0c76137adcaa..a9028a2c2db5 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -96,7 +96,7 @@ static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode, unsigned long arg) { uint64_t range[2]; - uint64_t start, len; + uint64_t start, len, end; struct inode *inode = bdev->bd_inode; int err; @@ -117,7 +117,8 @@ static int blk_ioctl_discard(struct block_device *bdev, blk_mode_t mode, if (len & 511) return -EINVAL; - if (start + len > bdev_nr_bytes(bdev)) + if (check_add_overflow(start, len, &end) || + end > bdev_nr_bytes(bdev)) return -EINVAL; filemap_invalidate_lock(inode->i_mapping); |