Skip to content

Clear ref_blkno output when block is already dirty#315

Open
aversecat wants to merge 1 commit into
mainfrom
auke/clear_ref_blkno_dirty
Open

Clear ref_blkno output when block is already dirty#315
aversecat wants to merge 1 commit into
mainfrom
auke/clear_ref_blkno_dirty

Conversation

@aversecat
Copy link
Copy Markdown
Contributor

block_dirty_ref() skipped setting *ref_blkno when the block was already dirty, leaving the caller with a stale value passed by reference.

dirty_alloc_blocks() calls it twice but when the referenced block is already dirty, it will receive the uninitialized stack value back, and then adding it freed list with list_block_add() later.

Set it to 0 on the already-dirty fast path so callers do not try to free a random block.

block_dirty_ref() skipped setting *ref_blkno when the block was
already dirty, leaving the caller with a stale value passed by
reference.

dirty_alloc_blocks() calls it twice but when the referenced block
is already dirty, it will receive the uninitialized stack value back,
and then adding it freed list with list_block_add() later.

Set it to 0 on the already-dirty fast path so callers do not try to
free a random block.

Signed-off-by: Auke Kok <auke.kok@versity.com>
@aversecat aversecat added the Bugfix Fixes a known bug label May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix Fixes a known bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant