net: broadcom: bcm4908_enet: update TX stats after actual transmission
authorRafał Miłecki <rafal@milecki.pl>
Thu, 27 Oct 2022 11:24:30 +0000 (13:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:59:19 +0000 (23:59 +0900)
commitc9589e18a60c55c76772a38117ef9a16b942e56b
tree8a5b5b28998d27fb3177be13d91cf2b73ab831d3
parent9711616a49086453f82d6571a57fc393a60d1d97
net: broadcom: bcm4908_enet: update TX stats after actual transmission

[ Upstream commit ef3556ee16c68735ec69bd08df41d1cd83b14ad3 ]

Queueing packets doesn't guarantee their transmission. Update TX stats
after hardware confirms consuming submitted data.

This also fixes a possible race and NULL dereference.
bcm4908_enet_start_xmit() could try to access skb after freeing it in
the bcm4908_enet_poll_tx().

Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes: 4feffeadbcb2e ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20221027112430.8696-1-zajec5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bcm4908_enet.c