-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mptcp: harmonize locking on all socket operations.
The locking schema implied by sendmsg(), recvmsg(), etc. requires acquiring the msk's socket lock before manipulating the msk internal status. Additionally, we can't acquire the msk->subflow socket lock while holding the msk lock, due to mptcp_finish_connect(). Many socket operations do not enforce the required locking, e.g. we have several patterns alike: if (msk->subflow) // do something with msk->subflow or: if (!msk->subflow) // allocate msk->subflow all without any lock acquired. They can race with each other and with mptcp_finish_connect() causing UAF, null ptr dereference and/or memory leaks. This patch ensures that all mptcp socket operations access and manipulate msk->subflow under the msk socket lock. To avoid breaking the locking assumption introduced by mptcp_finish_connect(), while avoiding UAF issues, we acquire a reference to the msk->subflow, where needed. Signed-off-by: Paolo Abeni <[email protected]>
- Loading branch information
1 parent
6aaede4
commit adcccc5
Showing
1 changed file
with
137 additions
and
54 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