RTEMS | Draft: posix/aio: Implemented aio_suspend() (!275)

Gedare Bloom (@gedare) gitlab at rtems.org
Tue Nov 5 21:17:26 UTC 2024




Gedare Bloom started a new discussion on cpukit/posix/src/aio_misc.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/275#note_114375

 > +  pthread_mutex_lock( &suspendcbp->mutex );
 > +  
 > +  if ( --suspendcbp->requests_left == 0 ) {
 > +    finished = 1;
 > +  }
 > +
 > +  if ( suspendcbp->notified == AIO_NONSIGNALED ) {
 > +    send_event = 1;
 > +    suspendcbp->notified = AIO_SIGNALED;
 > +  }
 > +  
 > +  pthread_mutex_unlock( &suspendcbp->mutex );
 > +
 > +  if ( send_event ) {
 > +    rtems_event_system_send(
 > +      suspendcbp->task_id,

here you read from the `suspendcbp` outside of the lock. Is there a race condition here that allows another thread to reach `free(suspendcbp)` before this read occurs?

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/275#note_114375
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20241105/de80cd34/attachment.htm>


More information about the bugs mailing list