Skip to content

Commit

Permalink
mt76: testmode: remove undefined behaviour in mt76_testmode_alloc_skb
Browse files Browse the repository at this point in the history
[ Upstream commit 223cea6 ]

Get rid of an undefined behaviour in mt76_testmode_alloc_skb routine
allocating skb frames

Fixes: 2601dda ("mt76: testmode: add support to send larger packet")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
LorenzoBianconi authored and gregkh committed Jul 14, 2021
1 parent 5b2deeb commit 31635a9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/net/wireless/mediatek/mt76/testmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,8 @@ int mt76_testmode_alloc_skb(struct mt76_phy *phy, u32 len)
head->len += frag->len;
head->data_len += frag->len;

if (*frag_tail) {
(*frag_tail)->next = frag;
frag_tail = &frag;
} else {
*frag_tail = frag;
}
*frag_tail = frag;
frag_tail = &(*frag_tail)->next;
}

mt76_testmode_free_skb(phy);
Expand Down

0 comments on commit 31635a9

Please sign in to comment.