Skip to content

Commit 50f801d

Browse files
Fix-Pointxiaoxiang781216
authored andcommitted
sched/wdog: Fix list traversal problem in nested wdog process
If g_wdactivelist has been changed in the wdog callback, the list traversal with next pointer will cause problem. Signed-off-by: ouyangxiangzhen <[email protected]> Signed-off-by: ligd <[email protected]>
1 parent ebf7f5f commit 50f801d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sched/wdog/wd_start.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@
9191
static inline_function void wd_expiration(clock_t ticks)
9292
{
9393
FAR struct wdog_s *wdog;
94-
FAR struct wdog_s *next;
9594
wdentry_t func;
9695

9796
/* Process the watchdog at the head of the list as well as any
9897
* other watchdogs that became ready to run at this time
9998
*/
10099

101-
list_for_every_entry_safe(&g_wdactivelist, wdog,
102-
next, struct wdog_s, node)
100+
while (!list_is_empty(&g_wdactivelist))
103101
{
102+
wdog = list_first_entry(&g_wdactivelist, struct wdog_s, node);
103+
104104
/* Check if expected time is expired */
105105

106106
if (!clock_compare(wdog->expired, ticks))

0 commit comments

Comments
 (0)