diff options
| author | TJ Adams <tadamsjr@google.com> | 2026-09-29 09:08:13 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-10-26 12:12:16 -0600 |
| commit | 82e72ea18d0af724914c31a1f274c1aef452aad0 (patch) | |
| tree | b7525ae5cc28792e6206ad248afa1a7f035c76ad /tools/lib/python | |
| parent | f89fa411b8526a0d3706a6139b6bc99869c80dc3 (diff) | |
block: advance iterator after copy-in for SG_DXFER_TO_FROM_DEV
When a passthrough request uses transfer direction SG_DXFER_TO_FROM_DEV,
bio_copy_user_iov() sets up a temporary iterator iter2 with
data_source = ITER_SOURCE to copy user data into the bio pages before
execution.
bio_copy_from_iter(bio, &iter2) copies the data and advances iter2, but
the original iter is never advanced. Consequently, iov_iter_count(&i)
remains non-zero in the caller loop in blk_rq_map_user_iov():
i = *iter;
do {
if (copy)
ret = bio_copy_user_iov(rq, map_data, &i, gfp_mask);
...
} while (iov_iter_count(&i));
Because i is never advanced, blk_rq_map_user_iov() loops indefinitely,
continually allocating bios and consuming map_data pages until it
exhausts pages and fails with -EINVAL.
Fix this by calling iov_iter_advance(iter, bio->bi_iter.bi_size) in the
map_data && map_data->from_user branch after bio_copy_from_iter().
Fixes: 13f3956eb568 ("block: Fix WARNING in _copy_from_iter")
Signed-off-by: Terrence Adams <tadamsjr@google.com>
Assisted-by: LLM
Acked-by: Christian A. Ehrhardt <lk@c--e.de>
Link: https://patch.msgid.link/20260929160813.1599129-1-tadamsjr@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
