1
0
Fork 0
alistair23-linux/drivers/net/ethernet/atheros/alx
Zekun Shen 6fd916e249 net: alx: fix race condition in alx_remove
[ Upstream commit e89df5c432 ]

There is a race condition exist during termination. The path is
alx_stop and then alx_remove. An alx_schedule_link_check could be called
before alx_stop by interrupt handler and invoke alx_link_check later.
Alx_stop frees the napis, and alx_remove cancels any pending works.
If any of the work is scheduled before termination and invoked before
alx_remove, a null-ptr-deref occurs because both expect alx->napis[i].

This patch fix the race condition by moving cancel_work_sync functions
before alx_free_napis inside alx_stop. Because interrupt handler can call
alx_schedule_link_check again, alx_free_irq is moved before
cancel_work_sync calls too.

Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-30 15:37:04 -04:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
alx.h net: alx: make alx_drv_name static 2018-11-05 17:12:58 -08:00
ethtool.c net: alx: use new api ethtool_{get|set}_link_ksettings 2016-11-14 13:37:42 -05:00
hw.c alx: add msi-x support 2016-09-09 20:51:21 -07:00
hw.h ethernet/atheros: use core min/max MTU checking 2016-10-18 11:34:18 -04:00
main.c net: alx: fix race condition in alx_remove 2020-06-30 15:37:04 -04:00
reg.h Add Killer E2500 device ID in alx driver. 2016-08-29 00:23:50 -04:00