Skip to content

Commit

Permalink
mt76: mt7915: fix potential memory leak in mcu message handler
Browse files Browse the repository at this point in the history
Fix potential memory leak in mcu message handler on error condition.

Fixes: c6b002bcdfa6 ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
ryderlee1110 authored and nbd168 committed Jul 21, 2020
1 parent 1f82841 commit 4c7e171
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ mt7915_mcu_parse_response(struct mt7915_dev *dev, int cmd,
struct mt7915_mcu_rxd *rxd = (struct mt7915_mcu_rxd *)skb->data;
int ret = 0;

if (seq != rxd->seq)
return -EAGAIN;
if (seq != rxd->seq) {
ret = -EAGAIN;
goto out;
}

switch (cmd) {
case -MCU_CMD_PATCH_SEM_CONTROL:
Expand All @@ -330,6 +332,7 @@ mt7915_mcu_parse_response(struct mt7915_dev *dev, int cmd,
default:
break;
}
out:
dev_kfree_skb(skb);

return ret;
Expand Down

0 comments on commit 4c7e171

Please sign in to comment.