* [PATCH] enic: Fix a sleep-in-atomic bug
@ 2017-05-31 2:34 Jia-Ju Bai
2017-05-31 18:37 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-05-31 2:34 UTC (permalink / raw)
To: benve, _govind, neepatel; +Cc: netdev, linux-kernel, Jia-Ju Bai
The driver may sleep under a spin lock in some function call paths.
The 1st function call path is:
enic_reset (acquire the lock by spin_lock)
enic_stop
enic_synchronize_irqs
synchronize_irq --> may sleep
The 2nd function call path is:
enic_reset (acquire the lock by spin_lock)
enic_dev_soft_reset
enic_dev_wait
schedule_timeout_uninterruptible --> may sleep
The 3rd function call path is:
enic_reset (acquire the lock by spin_lock)
enic_open
enic_request_intr
enic_set_rx_cpu_rmap
enic_free_rx_cpu_rmap
free_irq_cpu_rmap --> may sleep
To fix it, the "spin_lock" and "spin_unlock" are removed in enic_reset.
Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 4b87bee..2a9bef8 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -2310,7 +2310,6 @@ static void enic_reset(struct work_struct *work)
rtnl_lock();
- spin_lock(&enic->enic_api_lock);
enic_stop(enic->netdev);
enic_dev_soft_reset(enic);
enic_reset_addr_lists(enic);
@@ -2318,7 +2317,6 @@ static void enic_reset(struct work_struct *work)
enic_set_rss_nic_cfg(enic);
enic_dev_set_ig_vlan_rewrite_mode(enic);
enic_open(enic->netdev);
- spin_unlock(&enic->enic_api_lock);
call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev);
rtnl_unlock();
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] enic: Fix a sleep-in-atomic bug
2017-05-31 2:34 [PATCH] enic: Fix a sleep-in-atomic bug Jia-Ju Bai
@ 2017-05-31 18:37 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-31 18:37 UTC (permalink / raw)
To: baijiaju1990; +Cc: benve, _govind, neepatel, netdev, linux-kernel
From: Jia-Ju Bai <baijiaju1990@163.com>
Date: Wed, 31 May 2017 10:34:49 +0800
> The driver may sleep under a spin lock in some function call paths.
> The 1st function call path is:
> enic_reset (acquire the lock by spin_lock)
> enic_stop
> enic_synchronize_irqs
> synchronize_irq --> may sleep
> The 2nd function call path is:
> enic_reset (acquire the lock by spin_lock)
> enic_dev_soft_reset
> enic_dev_wait
> schedule_timeout_uninterruptible --> may sleep
> The 3rd function call path is:
> enic_reset (acquire the lock by spin_lock)
> enic_open
> enic_request_intr
> enic_set_rx_cpu_rmap
> enic_free_rx_cpu_rmap
> free_irq_cpu_rmap --> may sleep
>
> To fix it, the "spin_lock" and "spin_unlock" are removed in enic_reset.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
That's not necessarily safe at all, the lock is probably needed for
synchronization.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-31 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 2:34 [PATCH] enic: Fix a sleep-in-atomic bug Jia-Ju Bai
2017-05-31 18:37 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.