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 <ouyangxiangzhen@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ouyangxiangzhen 2024-07-05 19:24:34 +08:00 committed by Xiang Xiao
parent ebf7f5f748
commit 50f801dfaa

View File

@ -91,16 +91,16 @@
static inline_function void wd_expiration(clock_t ticks)
{
FAR struct wdog_s *wdog;
FAR struct wdog_s *next;
wdentry_t func;
/* Process the watchdog at the head of the list as well as any
* other watchdogs that became ready to run at this time
*/
list_for_every_entry_safe(&g_wdactivelist, wdog,
next, struct wdog_s, node)
while (!list_is_empty(&g_wdactivelist))
{
wdog = list_first_entry(&g_wdactivelist, struct wdog_s, node);
/* Check if expected time is expired */
if (!clock_compare(wdog->expired, ticks))