-
Notifications
You must be signed in to change notification settings - Fork 8.3k
stm32: drivers: serial: prevent possible race condition #91370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
60f6018 to
0c20c07
Compare
0c20c07 to
2669f08
Compare
4831bb7 to
3b2e97d
Compare
etienne-lms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed something: commit message header line should state the commit relates the stm32 uart driver only, e.g.:
drivers: serial: stm32: prevent race condition
The async_user_callback could be triggered from both the DMA transfer complete interrupt and a k_work queue timeout. Since the timeout runs outside of an ISR context, it could be interrupted by the DMA ISR. This might leads to a race condition where both paths access and modify shared DMA buffer state (offset and length) simultaneously, causing data corruption or out-of-sequence processing. Introduces proper synchronization to prevent concurrent access to shared DMA buffer variables, ensuring consistent and reliable data handling. Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
3b2e97d to
265b8fd
Compare
|
|
Yee-haw! Thanks everybody involved! |



This PR adds a mechanism to prevent a possible race condition between the DMA interrupt and the timeout callback in async_user_callback
FIxes #76799