Commit 1fa945b
net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
[ Upstream commit 6d72e7c ]
In emac_mac_tx_buf_send, it calls emac_tx_fill_tpd(..,skb,..).
If some error happens in emac_tx_fill_tpd(), the skb will be freed via
dev_kfree_skb(skb) in error branch of emac_tx_fill_tpd().
But the freed skb is still used via skb->len by netdev_sent_queue(,skb->len).
As i observed that emac_tx_fill_tpd() haven't modified the value of skb->len,
thus my patch assigns skb->len to 'len' before the possible free and
use 'len' instead of skb->len later.
Fixes: b9b17de ("net: emac: emac gigabit ethernet controller driver")
Signed-off-by: Lv Yunlong <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>1 parent 78da2d6 commit 1fa945b
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1437 | 1437 | | |
1438 | 1438 | | |
1439 | 1439 | | |
| 1440 | + | |
1440 | 1441 | | |
1441 | 1442 | | |
1442 | 1443 | | |
| |||
1456 | 1457 | | |
1457 | 1458 | | |
1458 | 1459 | | |
| 1460 | + | |
1459 | 1461 | | |
1460 | 1462 | | |
1461 | | - | |
| 1463 | + | |
1462 | 1464 | | |
1463 | 1465 | | |
1464 | 1466 | | |
| |||
0 commit comments