linux-stable/drivers/net/ethernet/atheros/alx
Zekun Shen e89df5c432 net: alx: fix race condition in alx_remove
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>
2020-06-15 13:20:14 -07: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-15 13:20:14 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
reg.h