]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links
authorCharles Han <hanchunchao@inspur.com>
Fri, 25 Oct 2024 07:55:54 +0000 (15:55 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2025 12:34:34 +0000 (13:34 +0100)
In mt7925_change_vif_links() devm_kzalloc() may return NULL but this
returned value is not checked.

Fixes: 69acd6d910b0 ("wifi: mt76: mt7925: add mt7925_change_vif_links")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://patch.msgid.link/20241025075554.181572-1-hanchunchao@inspur.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/main.c

index 791c8b00e11264667cf19f47586c9ed49d349a50..a5110f8485e526388e402bf073d0ac084f7bc47b 100644 (file)
@@ -1946,6 +1946,8 @@ 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)
+                               return -ENOMEM;
                }
 
                mconfs[link_id] = mconf;