anchao commented on code in PR #20387:
URL: https://github.com/apache/nuttx/pull/20387#discussion_r4129788747


##########
sched/wdog/wd_cancel.c:
##########
@@ -64,7 +64,11 @@ int wd_cancel(FAR struct wdog_s *wdog)
   irqstate_t         flags;
   int                  ret = -EINVAL;
 
-  if (wdog != NULL)
+  /* An inactive watchdog needs no lock.  A concurrent start is the same
+   * as a start just after this cancel.
+   */
+
+  if (wdog != NULL && WDOG_ISACTIVE(wdog))

Review Comment:
   There might be a race condition here if the active check is not within the 
scope of the lock.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to