Skip to content

Conversation

@AniruddhaKanhere
Copy link
Member

@AniruddhaKanhere AniruddhaKanhere commented Jul 6, 2022

Description

When the priority of the TCP/IP stack and the priority of the task using TCP/IP stack are equal AND when the task in question is using the recv function, then there is a possible race condition that exists in the stream buffers which lead to advertisement of 0 window.
This PR fixes that by adding a critical section around the stream buffer member update section.

Test Steps

Related Issue

This problem was reported by Shayan Mukhtar in this post on the FreeRTOS forum.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AniruddhaKanhere AniruddhaKanhere requested a review from a team as a code owner July 6, 2022 17:39
@AniruddhaKanhere
Copy link
Member Author

/bot run uncrustify

Copy link
Contributor

@htibosch htibosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AniruddhaKanhere wrote:

... when the task in question is using both send and recv functions

A small correction: there was a race condition between the IP-task and the task that calls recv().
The transmission stream works independently.

And maybe it is also worth telling that the problem was reported by Shayan Mukhtar in this post on the FreeRTOS forum.

To summarise the problem once more: the members uxHead and uxFront must be updated together, in a single atomic operation. Suspend/resume will be called from the IP-task only.

The solution was tested and I approve it.

Thank you

@AniruddhaKanhere
Copy link
Member Author

@htibosch, I updated my description. Thanks for pointing that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants