mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
Fix deadlock that occurs when iavf interface is a part of failover
configuration.
1. Mutex crit_lock is taken at the beginning of iavf_watchdog_task()
2. Function iavf_init_config_adapter() is called when adapter
state is __IAVF_INIT_CONFIG_ADAPTER
3. iavf_init_config_adapter() calls register_netdevice() that emits
NETDEV_REGISTER event
4. Notifier function failover_event() then calls
net_failover_slave_register() that calls dev_open()
5. dev_open() calls iavf_open() that tries to take crit_lock in
end-less loop
Stack trace:
...
[ 790.251876] usleep_range_state+0x5b/0x80
[ 790.252547] iavf_open+0x37/0x1d0 [iavf]
[ 790.253139] __dev_open+0xcd/0x160
[ 790.253699] dev_open+0x47/0x90
[ 790.254323] net_failover_slave_register+0x122/0x220 [net_failover]
[ 790.255213] failover_slave_register.part.7+0xd2/0x180 [failover]
[ 790.256050] failover_event+0x122/0x1ab [failover]
[ 790.256821] notifier_call_chain+0x47/0x70
[ 790.257510] register_netdevice+0x20f/0x550
[ 790.258263] iavf_watchdog_task+0x7c8/0xea0 [iavf]
[ 790.259009] process_one_work+0x1a7/0x360
[ 790.259705] worker_thread+0x30/0x390
To fix the situation we should check the current adapter state after
first unsuccessful mutex_trylock() and return with -EBUSY if it is
__IAVF_INIT_CONFIG_ADAPTER.
Fixes:
|
||
|---|---|---|
| .. | ||
| iavf_adminq_cmd.h | ||
| iavf_adminq.c | ||
| iavf_adminq.h | ||
| iavf_adv_rss.c | ||
| iavf_adv_rss.h | ||
| iavf_alloc.h | ||
| iavf_client.c | ||
| iavf_client.h | ||
| iavf_common.c | ||
| iavf_devids.h | ||
| iavf_ethtool.c | ||
| iavf_fdir.c | ||
| iavf_fdir.h | ||
| iavf_main.c | ||
| iavf_osdep.h | ||
| iavf_prototype.h | ||
| iavf_register.h | ||
| iavf_status.h | ||
| iavf_trace.h | ||
| iavf_txrx.c | ||
| iavf_txrx.h | ||
| iavf_type.h | ||
| iavf_virtchnl.c | ||
| iavf.h | ||
| Makefile | ||