wifi: mt76: mt7925: fix locking in mt7925_change_vif_links()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Sun, 27 Jul 2025 14:04:13 +0000 (07:04 -0700)
committerFelix Fietkau <nbd@nbd.name>
Wed, 27 Aug 2025 08:56:35 +0000 (10:56 +0200)
&dev->mt76.mutex lock is taken using mt792x_mutex_acquire(dev) but not
released in one of the error paths, add the unlock to fix it.

Fixes: 5cd0bd815c8a ("wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202503031055.3ZRqxhAl-lkp@intel.com/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://patch.msgid.link/20250727140416.1153406-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/main.c

index a8d25b7d47d045ef4e3c61cf9651174aeac28e5c..10390930751836f972baeff04b0869593244d11d 100644 (file)
@@ -2069,8 +2069,10 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                                             GFP_KERNEL);
                        mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink),
                                             GFP_KERNEL);
-                       if (!mconf || !mlink)
+                       if (!mconf || !mlink) {
+                               mt792x_mutex_release(dev);
                                return -ENOMEM;
+                       }
                }
 
                mconfs[link_id] = mconf;