Skip to content

backend: fix OOB access in usec_for_io() with DDIR_SYNC#2028

Merged
axboe merged 1 commit into
axboe:masterfrom
fmayer:patch-1
Dec 9, 2025
Merged

backend: fix OOB access in usec_for_io() with DDIR_SYNC#2028
axboe merged 1 commit into
axboe:masterfrom
fmayer:patch-1

Conversation

@fmayer
Copy link
Copy Markdown
Contributor

@fmayer fmayer commented Dec 8, 2025

When rate limiting is enabled, do_io() calls usec_for_io() to calculate
delays.

If the current operation is a sync (DDIR_SYNC), using it as an index into
arrays sized DDIR_RWDIR_CNT (such as td->rate_bps) results in an
out-of-bounds access.

Guard the rate limiting check in do_io() with ddir_rw() to ensure it only
applies to READ, WRITE, and TRIM operations.

This fixes a UBSAN out-of-bounds error reported in usec_for_io().

Signed-off-by: Florian Mayer [email protected]

When rate limiting is enabled, do_io() calls usec_for_io() to calculate
delays.

If the current operation is a sync (DDIR_SYNC), using it as an index into
arrays sized DDIR_RWDIR_CNT (such as td->rate_bps) results in an
out-of-bounds access.

Guard the rate limiting check in do_io() with ddir_rw() to ensure it only
applies to READ, WRITE, and TRIM operations.

This fixes a UBSAN out-of-bounds error reported in usec_for_io().

Signed-off-by: Florian Mayer <[email protected]>
@axboe axboe merged commit 26c77cd into axboe:master Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants