net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
authorPavel Andrianov <andrianov@ispras.ru>
Wed, 10 Mar 2021 08:10:46 +0000 (11:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Apr 2021 11:36:08 +0000 (13:36 +0200)
commitf0ed115feccc6073abcd982b2e6e6d048d2dbfd8
tree219335ad5ae30853eb6d32835c4f4d109153f186
parent4b4ce9895e64ee50f0c2b06d7c156d1f9123160b
net: pxa168_eth: Fix a potential data race in pxa168_eth_remove

[ Upstream commit 0571a753cb07982cc82f4a5115e0b321da89e1f3 ]

pxa168_eth_remove() firstly calls unregister_netdev(),
then cancels a timeout work. unregister_netdev() shuts down a device
interface and removes it from the kernel tables. If the timeout occurs
in parallel, the timeout work (pxa168_eth_tx_timeout_task) performs stop
and open of the device. It may lead to an inconsistent state and memory
leaks.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Pavel Andrianov <andrianov@ispras.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/marvell/pxa168_eth.c