developer | 3e11ee3 | 2023-09-27 12:24:47 +0800 | [diff] [blame] | 1 | From 80a4f15fa3077ef5a340a4af5b12fda8d958c337 Mon Sep 17 00:00:00 2001 |
| 2 | From: Bo Jiao <Bo.Jiao@mediatek.com> |
| 3 | Date: Tue, 18 Apr 2023 19:49:45 +0800 |
| 4 | Subject: [PATCH 31/39] wifi: mt76: mt7996: fix memory leak. |
| 5 | |
| 6 | Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| 7 | --- |
| 8 | mt7996/mcu.c | 10 ++++++++-- |
| 9 | 1 file changed, 8 insertions(+), 2 deletions(-) |
| 10 | |
| 11 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
| 12 | index a2c1e43..f98a48d 100644 |
| 13 | --- a/mt7996/mcu.c |
| 14 | +++ b/mt7996/mcu.c |
| 15 | @@ -2286,11 +2286,14 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw, |
| 16 | return PTR_ERR(rskb); |
| 17 | |
| 18 | skb = ieee80211_beacon_get_template(hw, vif, &offs, 0); |
| 19 | - if (!skb) |
| 20 | + if (!skb) { |
| 21 | + dev_kfree_skb(rskb); |
| 22 | return -EINVAL; |
| 23 | + } |
| 24 | |
| 25 | if (skb->len > MT7996_MAX_BEACON_SIZE) { |
| 26 | dev_err(dev->mt76.dev, "Bcn size limit exceed\n"); |
| 27 | + dev_kfree_skb(rskb); |
| 28 | dev_kfree_skb(skb); |
| 29 | return -EINVAL; |
| 30 | } |
| 31 | @@ -2351,11 +2354,14 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev, |
| 32 | skb = ieee80211_get_unsol_bcast_probe_resp_tmpl(hw, vif); |
| 33 | } |
| 34 | |
| 35 | - if (!skb) |
| 36 | + if (!skb) { |
| 37 | + dev_kfree_skb(rskb); |
| 38 | return -EINVAL; |
| 39 | + } |
| 40 | |
| 41 | if (skb->len > MT7996_MAX_BEACON_SIZE) { |
| 42 | dev_err(dev->mt76.dev, "inband discovery size limit exceed\n"); |
| 43 | + dev_kfree_skb(rskb); |
| 44 | dev_kfree_skb(skb); |
| 45 | return -EINVAL; |
| 46 | } |
| 47 | -- |
| 48 | 2.18.0 |
| 49 | |