-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pogo: turn serdev_ready to atomic variable to prevent deadlock
We are closing serdev on connect (if open), not on disconnect. There is a small possibility for MCU to send a message if it is physically disconnected and reconnected within a very short time. This is because there might just enough charge to keep the MCU running. At the same time the driver has initialized re-connection and tries to close serdev. In that situation the pogo lock is taken by fsm_entry_enumerate() while the tty lock is taken by pogo_onewire_receive_buf(). Then both functions try to take the other lock resulting in deadlock. At the same time serdev_ready should be 0. It is safe to check it without taking the lock and exit allowing fsm_entry_enumerate() to close and open serdev without deadlocking. Signed-off-by: Michal Koziel <michal.koziel@emlogic.no>
- Loading branch information
Showing
3 changed files
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters