History

Merge tag 'io_uring-6.18-20251107' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull io_uring fix from Jens Axboe: "Single fix in there, fixing an overflow in calculating the needed segments for converting into a bvec array" * tag 'io_uring-6.18-20251107' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: io_uring: fix regbuf vector size truncation

Linus Torvalds committed 1 year ago

Commit 3636cfa2 parents e284d51 146eb581 file · +9 −2Browse files

Unified · Split

io_uring/rsrc.c+9−2
@@ -1403,8 +1403,11 @@ static int io_estimate_bvec_size(struct iovec *iov, unsigned nr_iovs, · 1402 unmodified lines
14031403 size_t max_segs = 0;
14041404 unsigned i;
14051405
1406− for (i = 0; i < nr_iovs; i++)
1406+ for (i = 0; i < nr_iovs; i++) {
14071407 max_segs += (iov[i].iov_len >> shift) + 2;
1408+ if (max_segs > INT_MAX)
1409+ return -EOVERFLOW;
1410+ }
14081411 return max_segs;
14091412 }
14101413
@@ -1510,7 +1513,11 @@ int io_import_reg_vec(int ddir, struct iov_iter *iter, · 99 unmodified lines
15101513 if (unlikely(ret))
15111514 return ret;
15121515 } else {
1513− nr_segs = io_estimate_bvec_size(iov, nr_iovs, imu);
1516+ int ret = io_estimate_bvec_size(iov, nr_iovs, imu);
1517+
1518+ if (ret < 0)
1519+ return ret;
1520+ nr_segs = ret;
15141521 }
15151522
15161523 if (sizeof(struct bio_vec) > sizeof(struct iovec)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t