RDKEMW-21048: Mutex to access m_lastConnectedSSID in NMPlugin - #339
Open
me-ha-p wants to merge 3 commits into
Open
RDKEMW-21048: Mutex to access m_lastConnectedSSID in NMPlugin#339me-ha-p wants to merge 3 commits into
me-ha-p wants to merge 3 commits into
Conversation
…er Plugin Reason for change: Use mutex to access m_lastConnectedSSID in NetworkManager Plugin. Priority: P2 Test Procedure: Refer ticket Risks: Low Signed-off-by: Mehavarshni_Palaniswamy@comcast.com
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Comment on lines
891
to
896
| if(ssid.ssid.empty()) | ||
| { | ||
| NMLOG_WARNING("ssid is empty activating last connected ssid !"); | ||
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID)) | ||
| const string lastConnectedSSID = _instance->getLastConnectedSSID(); | ||
| NMLOG_WARNING("ssid is empty activating last connected ssid (%s) !", lastConnectedSSID.c_str()); | ||
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID)) | ||
| { |
karuna2git
reviewed
Aug 22, 2026
|
|
||
| if (!ssid.empty()) | ||
| m_lastConnectedSSID = ssid; // last connected ssid used in wifiConnect | ||
| setLastConnectedSSID(ssid); // last connected ssid used in wifiConnect |
Contributor
There was a problem hiding this comment.
Updating the LastConnectedSSID every min is expensive. Identify a suitable place n move; may be OnWiFiStateChange
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
plugin/gnome/NetworkManagerGnomeProxy.cpp:821
_instance->getLastConnectedSSID()is called before checking_instance != NULL. Since_instanceis a global pointer that can benullptr, this can dereference null whenssid.ssid.empty()is true. Move the null check before reading the SSID (or early-return when_instanceis null).
if(ssid.ssid.empty())
{
const string lastConnectedSSID = _instance->getLastConnectedSSID();
NMLOG_WARNING("ssid is empty activating last connected ssid (%s) !", lastConnectedSSID.c_str());
if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID))
{
Comment on lines
+469
to
+479
| void setLastConnectedSSID(const std::string& ssid) | ||
| { | ||
| std::lock_guard<std::mutex> lock(m_lastConnectedSSIDMutex); | ||
| m_lastConnectedSSID = ssid; | ||
| } | ||
|
|
||
| std::string getLastConnectedSSID() const | ||
| { | ||
| std::lock_guard<std::mutex> lock(m_lastConnectedSSIDMutex); | ||
| return m_lastConnectedSSID; | ||
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for change: Use mutex to access m_lastConnectedSSID in NetworkManager Plugin.
Priority: P2
Test Procedure: Refer ticket
Risks: Low
Signed-off-by: Mehavarshni_Palaniswamy@comcast.com