mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: dma: fix a possible memory leak in mt76_add_fragment()
Fix a memory leak in mt76_add_fragment routine returning the buffer
to the page_frag_cache when we receive a new fragment and the
skb_shared_info frag array is full.
Fixes: b102f0c522cf6 ("mt76: fix array overflow on receiving too many fragments for a packet")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Acked-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
2f85aa5cbc
commit
8696919d9a
@@ -513,15 +513,17 @@ static void
|
||||
mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
|
||||
int len, bool more)
|
||||
{
|
||||
struct page *page = virt_to_head_page(data);
|
||||
int offset = data - page_address(page);
|
||||
struct sk_buff *skb = q->rx_head;
|
||||
struct skb_shared_info *shinfo = skb_shinfo(skb);
|
||||
|
||||
if (shinfo->nr_frags < ARRAY_SIZE(shinfo->frags)) {
|
||||
offset += q->buf_offset;
|
||||
struct page *page = virt_to_head_page(data);
|
||||
int offset = data - page_address(page) + q->buf_offset;
|
||||
|
||||
skb_add_rx_frag(skb, shinfo->nr_frags, page, offset, len,
|
||||
q->buf_size);
|
||||
} else {
|
||||
skb_free_frag(data);
|
||||
}
|
||||
|
||||
if (more)
|
||||
|
||||
Reference in New Issue
Block a user