]> git.baikalelectronics.ru Git - kernel.git/commit
cxgb4: fix IRQ free race during driver unload
authorShahjada Abul Husain <shahjada@chelsio.com>
Thu, 8 Jul 2021 16:21:56 +0000 (21:51 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jul 2021 11:30:53 +0000 (13:30 +0200)
commitf40b1f7c8ef198875545c27eabf8b54ce9c19d64
tree3dcf7579a79201327d4cc3547cfedc433c1e55a1
parent9ad5da6c501bb51211de6e50bd9831a231188f08
cxgb4: fix IRQ free race during driver unload

[ Upstream commit 015fe6fd29c4b9ac0f61b8c4455ef88e6018b9cc ]

IRQs are requested during driver's ndo_open() and then later
freed up in disable_interrupts() during driver unload.
A race exists where driver can set the CXGB4_FULL_INIT_DONE
flag in ndo_open() after the disable_interrupts() in driver
unload path checks it, and hence misses calling free_irq().

Fix by unregistering netdevice first and sync with driver's
ndo_open(). This ensures disable_interrupts() checks the flag
correctly and frees up the IRQs properly.

Fixes: d716f24e66f1 ("cxgb4: Disable interrupts and napi before unregistering netdev")
Signed-off-by: Shahjada Abul Husain <shahjada@chelsio.com>
Signed-off-by: Raju Rangoju <rajur@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c