Re: [PATCH] ath10k: Fix deadlock when peer cannot be created.

2016-04-05 Thread Valo, Kalle
Julian Calaby  writes:

> On Thu, Mar 31, 2016 at 10:08 AM,   wrote:
>> From: Ben Greear 
>>
>> We must not attempt to send WMI packets while dholding the data-lock,
>
> s/dholding/holding/ ?

I fixed it in the pending branch.

-- 
Kalle Valo--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: Fix deadlock when peer cannot be created.

2016-03-30 Thread Julian Calaby
Hi Ben,

On Thu, Mar 31, 2016 at 10:08 AM,   wrote:
> From: Ben Greear 
>
> We must not attempt to send WMI packets while dholding the data-lock,

s/dholding/holding/ ?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath10k: Fix deadlock when peer cannot be created.

2016-03-30 Thread greearb
From: Ben Greear 

We must not attempt to send WMI packets while dholding the data-lock,
as it may deadlock:

BUG: sleeping function called from invalid context at 
drivers/net/wireless/ath/ath10k/wmi.c:1824
in_atomic(): 1, irqs_disabled(): 0, pid: 2878, name: wpa_supplicant

=
[ INFO: possible recursive locking detected ]
4.4.6+ #21 Tainted: GW  O
-
wpa_supplicant/2878 is trying to acquire lock:
 (&(&ar->data_lock)->rlock){+.-...}, at: [] 
ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]

but task is already holding lock:
 (&(&ar->data_lock)->rlock){+.-...}, at: [] 
ath10k_peer_create+0x122/0x1ae [ath10k_core]

other info that might help us debug this:
 Possible unsafe locking scenario:

   CPU0
   
  lock(&(&ar->data_lock)->rlock);
  lock(&(&ar->data_lock)->rlock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by wpa_supplicant/2878:
 #0:  (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0x12/0x14
 #1:  (&ar->conf_mutex){+.+.+.}, at: [] 
ath10k_add_interface+0x3b/0xbda [ath10k_core]
 #2:  (&(&ar->data_lock)->rlock){+.-...}, at: [] 
ath10k_peer_create+0x122/0x1ae [ath10k_core]
 #3:  (rcu_read_lock){..}, at: [] rcu_read_lock+0x0/0x66 
[mac80211]

stack backtrace:
CPU: 3 PID: 2878 Comm: wpa_supplicant Tainted: GW  O4.4.6+ #21
Hardware name: To be filled by O.E.M. To be filled by O.E.M./ChiefRiver, BIOS 
4.6.5 06/07/2013
  8801fcadf8f0 8137086d 82681720
 82681720 8801fcadf9b0 8112e3be 8801fcadf920
 0001 82681720 a0721500 8801fcb8d348
Call Trace:
 [] dump_stack+0x81/0xb6
 [] __lock_acquire+0xc5b/0xde7
 [] ? ath10k_wmi_tx_beacons_iter+0x15/0x11a [ath10k_core]
 [] ? mark_lock+0x24/0x201
 [] lock_acquire+0x132/0x1cb
 [] ? lock_acquire+0x132/0x1cb
 [] ? ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]
 [] ? ath10k_wmi_cmd_send_nowait+0x1ce/0x1ce [ath10k_core]
 [] _raw_spin_lock_bh+0x31/0x40
 [] ? ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]
 [] ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]
 [] ? ath10k_wmi_cmd_send_nowait+0x1ce/0x1ce [ath10k_core]
 [] __iterate_interfaces+0x9d/0x13d [mac80211]
 [] ieee80211_iterate_active_interfaces_atomic+0x32/0x3e 
[mac80211]
 [] ? ath10k_wmi_cmd_send_nowait+0x1ce/0x1ce [ath10k_core]
 [] ath10k_wmi_tx_beacons_nowait.isra.13+0x14/0x16 
[ath10k_core]
 [] ath10k_wmi_cmd_send+0x71/0x242 [ath10k_core]
 [] ath10k_wmi_peer_delete+0x3f/0x42 [ath10k_core]
 [] ath10k_peer_create+0x15e/0x1ae [ath10k_core]
 [] ath10k_add_interface+0x70d/0xbda [ath10k_core]
 [] drv_add_interface+0x123/0x1a5 [mac80211]
 [] ieee80211_do_open+0x351/0x667 [mac80211]
 [] ieee80211_open+0x49/0x4c [mac80211]
 [] __dev_open+0x88/0xde
 [] __dev_change_flags+0xa4/0x13a
 [] dev_change_flags+0x1f/0x54
 [] devinet_ioctl+0x2b9/0x5c9
 [] ? copy_to_user+0x32/0x38
 [] inet_ioctl+0x81/0x9d
 [] ? inet_ioctl+0x81/0x9d
 [] sock_do_ioctl+0x20/0x3d
 [] sock_ioctl+0x222/0x22e
 [] do_vfs_ioctl+0x453/0x4d7
 [] ? __sys_recvmsg+0x4c/0x5b
 [] ? __fget_light+0x48/0x6c
 [] SyS_ioctl+0x52/0x74
 [] entry_SYSCALL_64_fastpath+0x16/0x7a

Signed-off-by: Ben Greear 
---
 drivers/net/wireless/ath/ath10k/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6e781e6..bf59a49 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -700,10 +700,10 @@ static int ath10k_peer_create(struct ath10k *ar,
 
peer = ath10k_peer_find(ar, vdev_id, addr);
if (!peer) {
+   spin_unlock_bh(&ar->data_lock);
ath10k_warn(ar, "failed to find peer %pM on vdev %i after 
creation\n",
addr, vdev_id);
ath10k_wmi_peer_delete(ar, vdev_id, addr);
-   spin_unlock_bh(&ar->data_lock);
return -ENOENT;
}
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html