]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: fix missing transmission lock in rtw_xmit
authorKarthikey D Kadati <karthikey3608@gmail.com>
Sat, 27 Dec 2025 11:33:48 +0000 (17:03 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Jan 2026 12:52:25 +0000 (13:52 +0100)
The packet transmission path in rtw_xmit.c contained TODO comments
indicating a missing lock. This patch implements spin_lock_bh and
spin_unlock_bh around the station attribute update section.

This prevents a potential race condition where station security and
PHY information could be modified on another CPU core during
transmission. The use of _bh variants ensures safety in bottom-half
contexts common in network transmit paths.

Verified that psta is NULL-checked prior to acquisition and that no
double-unlocks occur on the exit path.

Signed-off-by: Karthikey D Kadati <karthikey3608@gmail.com>
Link: https://patch.msgid.link/20251227113348.26272-1-karthikey3608@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_xmit.c

index ae482c28b40b8a87087fd1ed5bba676958635bd7..7aaef2cbc9ac63267b11a02c8d51e9fb26467f78 100644 (file)
@@ -715,8 +715,9 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
        if (!(psta->state & _FW_LINKED))
                return _FAIL;
 
-       /* TODO:_lock */
+       spin_lock_bh(&psta->lock);
        if (update_attrib_sec_info(padapter, pattrib, psta) == _FAIL) {
+               spin_unlock_bh(&psta->lock);
                res = _FAIL;
                goto exit;
        }
@@ -724,7 +725,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
        update_attrib_phy_info(padapter, pattrib, psta);
 
        pattrib->psta = psta;
-       /* TODO:_unlock */
+       spin_unlock_bh(&psta->lock);
 
        pattrib->pctrl = 0;