Skip to content

RDKEMW-21048: Mutex to access m_lastConnectedSSID in NMPlugin - #339

Open
me-ha-p wants to merge 3 commits into
developfrom
feature/RDKEMW-21048
Open

RDKEMW-21048: Mutex to access m_lastConnectedSSID in NMPlugin#339
me-ha-p wants to merge 3 commits into
developfrom
feature/RDKEMW-21048

Conversation

@me-ha-p

@me-ha-p me-ha-p commented Aug 19, 2026

Copy link
Copy Markdown

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

…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
Copilot AI lite review requested due to automatic review settings August 19, 2026 05:54
@me-ha-p
me-ha-p requested a review from a team as a code owner August 19, 2026 05:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Copilot AI review requested due to automatic review settings August 22, 2026 15:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

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))
{

if (!ssid.empty())
m_lastConnectedSSID = ssid; // last connected ssid used in wifiConnect
setLastConnectedSSID(ssid); // last connected ssid used in wifiConnect

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating the LastConnectedSSID every min is expensive. Identify a suitable place n move; may be OnWiFiStateChange

Copilot AI review requested due to automatic review settings August 24, 2026 04:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _instance is a global pointer that can be nullptr, this can dereference null when ssid.ssid.empty() is true. Move the null check before reading the SSID (or early-return when _instance is 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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants