RDKEMW-20574 : Fix the notification locks in networkmanager plugin#319
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses lock-related issues in the NetworkManager plugin by tightening the scope of notification callback locking and adding a dedicated lock for WiFi scan filter vectors to prevent concurrent access problems during scan option updates and scan result filtering.
Changes:
- Narrow
_notificationLockscope so it’s held primarily during notification callback iteration rather than across additional work/telemetry logging. - Introduce
_filterVectorsLockto protectm_filterSsidslist/m_filterFrequenciesduring updates and filtering. - In the GNOME backend, snapshot the SSID filter vector before issuing a scan request to avoid races with later modifications.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugin/rdk/NetworkManagerRDKProxy.cpp | Adds locking around updates to WiFi scan filter vectors for the RDK backend. |
| plugin/NetworkManagerImplementation.h | Introduces _filterVectorsLock to protect shared filter vectors. |
| plugin/NetworkManagerImplementation.cpp | Adjusts notification lock scope and adds filter-vector locking around scan result filtering. |
| plugin/gnome/NetworkManagerGnomeProxy.cpp | Adds locking for filter vector updates and uses an SSID snapshot for scan requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| m_filterVectorsLock.Lock(); | ||
| // Replace existing stored filters only after successful parsing/validation. | ||
| m_filterSsidslist.clear(); | ||
| m_filterFrequencies.clear(); | ||
| m_filterSsidslist = filteredSsids; | ||
| m_filterFrequencies = filteredFrequencies; | ||
| m_filterVectorsLock.Unlock(); |
There was a problem hiding this comment.
Since filteredSsids is still needed after updating m_filterSsidslist, then do not use std::move() or std::swap() because the contents of filteredSsids become unspecified.
C++m_filterSsidslist = filteredSsids; This is the clearest and safest option.
Reason for change: Fix the notification locks in networkmanager plugin
Priority: P1
Test Procedure: Check the test steps in RDKEMW-20574
Risks: medium
Signed-off-by: jincysaramma_sam@comcast.com