| From 80a4f15fa3077ef5a340a4af5b12fda8d958c337 Mon Sep 17 00:00:00 2001 |
| From: Bo Jiao <Bo.Jiao@mediatek.com> |
| Date: Tue, 18 Apr 2023 19:49:45 +0800 |
| Subject: [PATCH 31/39] wifi: mt76: mt7996: fix memory leak. |
| |
| Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| --- |
| mt7996/mcu.c | 10 ++++++++-- |
| 1 file changed, 8 insertions(+), 2 deletions(-) |
| |
| diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
| index a2c1e43..f98a48d 100644 |
| --- a/mt7996/mcu.c |
| +++ b/mt7996/mcu.c |
| @@ -2286,11 +2286,14 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw, |
| return PTR_ERR(rskb); |
| |
| skb = ieee80211_beacon_get_template(hw, vif, &offs, 0); |
| - if (!skb) |
| + if (!skb) { |
| + dev_kfree_skb(rskb); |
| return -EINVAL; |
| + } |
| |
| if (skb->len > MT7996_MAX_BEACON_SIZE) { |
| dev_err(dev->mt76.dev, "Bcn size limit exceed\n"); |
| + dev_kfree_skb(rskb); |
| dev_kfree_skb(skb); |
| return -EINVAL; |
| } |
| @@ -2351,11 +2354,14 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev, |
| skb = ieee80211_get_unsol_bcast_probe_resp_tmpl(hw, vif); |
| } |
| |
| - if (!skb) |
| + if (!skb) { |
| + dev_kfree_skb(rskb); |
| return -EINVAL; |
| + } |
| |
| if (skb->len > MT7996_MAX_BEACON_SIZE) { |
| dev_err(dev->mt76.dev, "inband discovery size limit exceed\n"); |
| + dev_kfree_skb(rskb); |
| dev_kfree_skb(skb); |
| return -EINVAL; |
| } |
| -- |
| 2.18.0 |
| |