[riot-notifications] [RIOT-OS/RIOT] gnrc_tcp: fix data race on fsm status (#16279)

Simon Brummer notifications at github.com
Sun Apr 4 17:49:25 CEST 2021

### Contribution description
This PR fixes a race condition within gnrc_tcp. The multiple threads within gnrc_tcp read the connections
state of the TCB processing FSM to base decisions on. This state variable is only changed within the FSM function
that are protected by a mutex. The current readout of the state is not protected.

This PR adds a function to get the current state of the FSM. Calling the function locks/unlocks the FSM and returns
the current state. This adds a dedicated synchronization point to resolve the issue.

### Testing procedure
This fix should not change the behavior of gnrc_tcp. To test the changes, run the gnrc_tcp test suite.

### Issues/PRs references
None. I came across this, implementing something else.
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * gnrc_tcp: fix data race on fsm status

-- File Changes --

    M sys/net/gnrc/transport_layer/tcp/gnrc_tcp.c (46)
    M sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloop.c (3)
    M sys/net/gnrc/transport_layer/tcp/gnrc_tcp_fsm.c (10)
    M sys/net/gnrc/transport_layer/tcp/include/gnrc_tcp_fsm.h (9)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210404/0296a906/attachment.htm>

More information about the notifications mailing list