This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001913] New: Calling restart_rx outside cyg_drv_dsr_lock/unlock in serial_get_config: possibly a race condition?


Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001913

            Bug ID: 1001913
           Summary: Calling restart_rx outside cyg_drv_dsr_lock/unlock in
                    serial_get_config: possibly a race condition?
           Product: eCos
           Version: 3.0
            Target: All
  Architecture/Host All
                OS:
            Status: UNCONFIRMED
          Severity: normal
          Priority: low
         Component: Serial
          Assignee: unassigned@bugs.ecos.sourceware.org
          Reporter: vlad_a_pudovkin@hotmail.com
                CC: ecos-bugs@ecos.sourceware.org

I'm not quite sure this is a bug, but this snippet below seems to be the only
place in the serial IO code where restart_rx (and the data it accesses) is used
outside of the cyg_drv_dsr_lock/unlock pair, which just stood out for me:

// File: packages/io/serial/<version>/src/common/serial.c
// Function: serial_get_config

        * * *
        cyg_drv_dsr_unlock();
        cyg_drv_mutex_unlock(&in_cbuf->lock);
#ifdef CYGPKG_IO_SERIAL_FLOW_CONTROL
        // Restart receiver if it was shutdown
        if ((chan->flow_desc.flags & CYG_SERIAL_FLOW_IN_THROTTLED) != 0) {
            restart_rx( chan, false );
        }
#endif


Wouldn't it be more correct (or at least more consistent) to move this
if-statement right prior to unlocking the DSRs and the mutex? If not, why?

-- 
You are receiving this mail because:
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]