io_uring-6.18-20251107

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmkOl6IQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpsEQEADcUvKbeDJf/iJyvb6ZowULZZbK7iAAc54/
 rCmdEtVd8isBw16KIGgt7ru+8AmdH5F+6knGTA9TO3ddLbfbPIN6D2khymXTB7Im
 B8srIzxOU99VUFnJC/SyMksIToMFm1I7AE882cVOR4xLBxRDQ28Fqf3tGOgLkvis
 Nr6BwFmir7hE60R195UtHrvYJYLr5+LBsBx/75WUACbcuEH1rwEHH5Z6Jt8PGZgj
 1RMKMFkR+QotBfk9YoCcXSUoZ8iK/X0otlFLf2YzJvN1b5b6UlxA0X44WM6YMH4r
 yQuRiQFKHnyqoxxTXXkjJ4g4W9Fn8hzVVjoJiRsKw+gfrUPgV5my2fxRHHeVvY13
 sMjctAx0incISZdlgcDFx8JeXGq2BIxwODsFAhQQj3qu9YAyXzpFYsNmZ4vRPvS0
 uXcKvZrCQa7++LiAwW1TNs+RbiIAMdKZfaPVhZVSxNZEtxfwgqS569KTGS0n/k8e
 CzZVgpaPoD8GsHhMULBXd4eEfoh0Ywnqvw/FeIEgOEHycyD32UQexgMyarlEHCaL
 vw8GThS2aL/lwPDN6rNZQrfYYp9t5dOwpR/NRkmnNKBwgYR1QFjnDPTyu/gq5oRr
 WHMNJ53cJpWxWmmy974BrWbw1ZEy2VwvAT4OMgpti9RHj3A9/gEczZKTFpQZbsz5
 0rJo7s+t3g==
 =CZJ/
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-11-08 08:47:31 -08:00
commit 3636cfa745

View File

@ -1403,8 +1403,11 @@ static int io_estimate_bvec_size(struct iovec *iov, unsigned nr_iovs,
size_t max_segs = 0;
unsigned i;
for (i = 0; i < nr_iovs; i++)
for (i = 0; i < nr_iovs; i++) {
max_segs += (iov[i].iov_len >> shift) + 2;
if (max_segs > INT_MAX)
return -EOVERFLOW;
}
return max_segs;
}
@ -1510,7 +1513,11 @@ int io_import_reg_vec(int ddir, struct iov_iter *iter,
if (unlikely(ret))
return ret;
} else {
nr_segs = io_estimate_bvec_size(iov, nr_iovs, imu);
int ret = io_estimate_bvec_size(iov, nr_iovs, imu);
if (ret < 0)
return ret;
nr_segs = ret;
}
if (sizeof(struct bio_vec) > sizeof(struct iovec)) {