mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 06:01:53 +02:00
wifi: mt76: mt7915: fix memory leak in mt7915_mmio_wed_init_rx_buf
Free mt76_txwi_cache pointer in mt7915_mmio_wed_init_rx_buf routine in
case of failure.
Fixes: 4f831d18d1 ("wifi: mt76: mt7915: enable WED RX support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
c222f77fd4
commit
412d19b420
|
|
@ -635,16 +635,22 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
|
|||
int token;
|
||||
void *ptr;
|
||||
|
||||
page = __dev_alloc_pages(GFP_KERNEL, get_order(length));
|
||||
if (!page)
|
||||
if (!t)
|
||||
goto unmap;
|
||||
|
||||
page = __dev_alloc_pages(GFP_KERNEL, get_order(length));
|
||||
if (!page) {
|
||||
mt76_put_rxwi(&dev->mt76, t);
|
||||
goto unmap;
|
||||
}
|
||||
|
||||
ptr = page_address(page);
|
||||
phy_addr = dma_map_single(dev->mt76.dma_dev, ptr,
|
||||
wed->wlan.rx_size,
|
||||
DMA_TO_DEVICE);
|
||||
if (unlikely(dma_mapping_error(dev->mt76.dev, phy_addr))) {
|
||||
__free_pages(page, get_order(length));
|
||||
mt76_put_rxwi(&dev->mt76, t);
|
||||
goto unmap;
|
||||
}
|
||||
|
||||
|
|
@ -654,6 +660,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
|
|||
dma_unmap_single(dev->mt76.dma_dev, phy_addr,
|
||||
wed->wlan.rx_size, DMA_TO_DEVICE);
|
||||
__free_pages(page, get_order(length));
|
||||
mt76_put_rxwi(&dev->mt76, t);
|
||||
goto unmap;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user