Skip to content

block: fix infinite loop in badblocks_clear() and badblocks_check()#771

Open
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1085695=>linus-master
Open

block: fix infinite loop in badblocks_clear() and badblocks_check()#771
blktests-ci[bot] wants to merge 1 commit intolinus-master_basefrom
series/1085695=>linus-master

Conversation

@blktests-ci
Copy link
Copy Markdown

@blktests-ci blktests-ci Bot commented Apr 26, 2026

Pull request for series with
subject: block: fix infinite loop in badblocks_clear() and badblocks_check()
version: 3
url: https://patchwork.kernel.org/project/linux-block/list/?series=1085695

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 26, 2026

Upstream branch: dd6c438
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 29, 2026

Upstream branch: dca922e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1085695=>linus-master branch from c7e9309 to d4bb75a Compare April 29, 2026 02:27
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 482ce5b to 5a9f7c7 Compare April 30, 2026 07:29
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented Apr 30, 2026

Upstream branch: e75a43c
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1085695=>linus-master branch from d4bb75a to 01614ce Compare April 30, 2026 07:35
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5a9f7c7 to 25a041f Compare May 3, 2026 02:07
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 3, 2026

Upstream branch: 66edb90
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1085695=>linus-master branch from 01614ce to 8c9505c Compare May 3, 2026 02:37
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 25a041f to 6f75bd1 Compare May 4, 2026 10:57
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 4, 2026

Upstream branch: 6d35786
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1085695=>linus-master branch from 8c9505c to deb68de Compare May 4, 2026 11:30
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 6f75bd1 to 1f0d33a Compare May 5, 2026 15:39
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 5, 2026

Upstream branch: 6d35786
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1085695=>linus-master branch from deb68de to f4fe77d Compare May 5, 2026 16:02
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 1f0d33a to b1870f6 Compare May 10, 2026 15:59
An infinite loop can occur in both _badblocks_clear() and _badblocks_check()
when BB_OFFSET() equals the start position, resulting in len = 0. This causes
the update_sectors loop to spin forever without making progress:

    s += 0;         // no advancement
    sectors -= 0;   // stays positive
    goto re_clear;  // infinite loop

The bug exists in three code paths:
1. _badblocks_clear() at line 1100 (start before all badblocks)
2. _badblocks_clear() at line 1153 (behind overlap check)
3. _badblocks_check() at line 1240 (behind overlap check)

Add checks in all three locations to ensure len is non-zero before
entering the loop.

Signed-off-by: Ramesh Adhikari <adhikari.resume@gmail.com>
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 10, 2026

Upstream branch: aa54b1d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085695
version: 3

@blktests-ci blktests-ci Bot force-pushed the series/1085695=>linus-master branch from f4fe77d to 02e7612 Compare May 10, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant