-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: lwm2m: Make LwM2M message allocation thread safe
The LwM2M message allocation was not thread safe, i. e. the message was acquired by setting the ctx pointer, and it was freed by clearing the entire message structure. If preemptive threads were enabled, and memset() clearing the message content was preempted, the message structure being currently zeroed migh've been allocated and initialized by some other thread. If the thread releasing the message resumed work, it would continue clearing the freshly allocated and initialized message structure. In order to prevent this, introduce a new global mutex for the lwm2m engine global variables. The mutex is used when LwM2M message is allocated/deallocated. This will prevent reallocating the message during the release process. Signed-off-by: Robert Lubos <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
2 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