Commit 02d2577
block: fix infinite loop in badblocks_clear()
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
After approximately 21 seconds, the RCU stall detector triggers and the
system becomes completely unresponsive, requiring a hard reboot.
Add a check to ensure len is non-zero before entering the loop.
Signed-off-by: Ramesh Adhikari <[email protected]>1 parent 857ada9 commit 02d2577
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1151 | 1151 | | |
1152 | 1152 | | |
1153 | 1153 | | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
1154 | 1158 | | |
1155 | 1159 | | |
1156 | 1160 | | |
| |||
0 commit comments