Commit fe2c3b1f authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

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: 2601dda8 ("mt76: testmode: add support to send larger packet")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent ffce39bf
...@@ -158,8 +158,11 @@ int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len) ...@@ -158,8 +158,11 @@ int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len)
frag_len = MT_TXP_MAX_LEN; frag_len = MT_TXP_MAX_LEN;
frag = alloc_skb(frag_len, GFP_KERNEL); frag = alloc_skb(frag_len, GFP_KERNEL);
if (!frag) if (!frag) {
mt76_testmode_free_skb(phy);
dev_kfree_skb(head);
return -ENOMEM; return -ENOMEM;
}
__skb_put_zero(frag, frag_len); __skb_put_zero(frag, frag_len);
head->len += frag->len; head->len += frag->len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment