mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
wifi: brcmfmac: unmap dma buffer in brcmf_msgbuf_alloc_pktid()
[ Upstream commitb9f420032f] After the DMA buffer is mapped to a physical address, address is stored in pktids in brcmf_msgbuf_alloc_pktid(). Then, pktids is parsed in brcmf_msgbuf_get_pktid()/brcmf_msgbuf_release_array() to obtain physaddr and later unmap the DMA buffer. But when count is always equal to pktids->array_size, physaddr isn't stored in pktids and the DMA buffer will not be unmapped anyway. Fixes:9a1bb60250("brcmfmac: Adding msgbuf protocol.") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20221207013114.1748936-1-shaozhengchao@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e08e6812ef
commit
b4b4447481
@@ -346,8 +346,11 @@ brcmf_msgbuf_alloc_pktid(struct device *dev,
|
|||||||
count++;
|
count++;
|
||||||
} while (count < pktids->array_size);
|
} while (count < pktids->array_size);
|
||||||
|
|
||||||
if (count == pktids->array_size)
|
if (count == pktids->array_size) {
|
||||||
|
dma_unmap_single(dev, *physaddr, skb->len - data_offset,
|
||||||
|
pktids->direction);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
array[*idx].data_offset = data_offset;
|
array[*idx].data_offset = data_offset;
|
||||||
array[*idx].physaddr = *physaddr;
|
array[*idx].physaddr = *physaddr;
|
||||||
|
|||||||
Reference in New Issue
Block a user