mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 12:32:50 +00:00
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: 2601dda8fa ("mt76: testmode: add support to send larger packet")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
committed by
Felix Fietkau
parent
ffce39bfb6
commit
fe2c3b1fc6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user