Skip to content

Commit 7cb8cd4

Browse files
LorenzoBianconiPaolo Abeni
authored andcommitted
net: ethernet: mtk_wed: fix possible NULL pointer dereference in mtk_wed_wo_queue_tx_clean()
In order to avoid a NULL pointer dereference, check entry->buf pointer before running skb_free_frag in mtk_wed_wo_queue_tx_clean routine. Fixes: 7996844 ("net: ethernet: mtk_wed: introduce wed wo support") Signed-off-by: Lorenzo Bianconi <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/3c1262464d215faa8acebfc08869798c81c96f4a.1702827359.git.lorenzo@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent bd7f77d commit 7cb8cd4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ethernet/mediatek/mtk_wed_wo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ mtk_wed_wo_queue_tx_clean(struct mtk_wed_wo *wo, struct mtk_wed_wo_queue *q)
291291
for (i = 0; i < q->n_desc; i++) {
292292
struct mtk_wed_wo_queue_entry *entry = &q->entry[i];
293293

294+
if (!entry->buf)
295+
continue;
296+
294297
dma_unmap_single(wo->hw->dev, entry->addr, entry->len,
295298
DMA_TO_DEVICE);
296299
skb_free_frag(entry->buf);

0 commit comments

Comments
 (0)