mt76: testmode: fix memory leak in mt76_testmode_alloc_skb

Free all pending frames in case of failure in mt76_testmode_alloc_skb
routine

Fixes: 2601dda8faa76 ("mt76: testmode: add support to send larger packet")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Lorenzo Bianconi
2021-05-28 11:52:34 +02:00
committed by Felix Fietkau
parent 597b68b7da
commit 3945264468
+4 -1
View File
@@ -158,8 +158,11 @@ int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len)
frag_len = MT_TXP_MAX_LEN;
frag = alloc_skb(frag_len, GFP_KERNEL);
if (!frag)
if (!frag) {
mt76_testmode_free_skb(phy);
dev_kfree_skb(head);
return -ENOMEM;
}
__skb_put_zero(frag, frag_len);
head->len += frag->len;