Skip to content

block: fix infinite loop in badblocks_clear()#770

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

block: fix infinite loop in badblocks_clear()#770
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1085681=>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()
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1085681

@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=1085681
version: 1

@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=1085693
version: 2

@blktests-ci blktests-ci Bot added V2 and removed V1 labels Apr 26, 2026
@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 02d2577 to b27d89c Compare April 26, 2026 17:15
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 857ada9 to 482ce5b Compare April 29, 2026 02:21
@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=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from b27d89c to ded6f5d 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=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from ded6f5d to 6fdf687 Compare April 30, 2026 07:34
@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=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 6fdf687 to d15b186 Compare May 3, 2026 02:21
@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=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from d15b186 to b9f253f Compare May 4, 2026 11:31
@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=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from b9f253f to 6fe6147 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
@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=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 6fe6147 to 0416c2f Compare May 10, 2026 16:26
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from b1870f6 to ca57796 Compare May 15, 2026 07:55
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 15, 2026

Upstream branch: 70eda68
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 0416c2f to 18b8f5f Compare May 15, 2026 08:35
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ca57796 to c1feb59 Compare May 21, 2026 02:54
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 21, 2026

Upstream branch: 8bc67e4
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 18b8f5f to 054a576 Compare May 21, 2026 03:38
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c1feb59 to ea833a1 Compare May 22, 2026 01:53
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 22, 2026

Upstream branch: 6779b50
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085693
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 054a576 to 7e9d5fa Compare May 22, 2026 02:35
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from ea833a1 to 7af85d1 Compare May 23, 2026 06:11
@blktests-ci
Copy link
Copy Markdown
Author

blktests-ci Bot commented May 23, 2026

Upstream branch: 79bd2dd
series: https://patchwork.kernel.org/project/linux-block/list/?series=1085693
version: 2

An infinite loop can occur in _badblocks_clear() when BB_OFFSET(p[prev + 1])
equals bad.start, 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 two code paths:
1. _badblocks_clear() at line 1153 (behind overlap check)
2. _badblocks_check() at line 1240 (behind overlap check)

Add checks in both functions to ensure len is non-zero before entering
the loop.

Signed-off-by: Ramesh Adhikari <adhikari.resume@gmail.com>
@blktests-ci blktests-ci Bot force-pushed the series/1085681=>linus-master branch from 7e9d5fa to 6284b26 Compare May 23, 2026 07:30
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