wil6210: fix locking in wmi_call

[ Upstream commit dc57731dbd ]

Switch from spin_lock to spin_lock_irqsave, because
wmi_ev_lock is used inside interrupt handler.

Signed-off-by: Lior David <liord@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Lior David 2018-10-31 10:52:24 +02:00 committed by Greg Kroah-Hartman
parent ccb2390e89
commit c262dc0655

View file

@ -1639,16 +1639,17 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, u8 mid, void *buf, u16 len,
{ {
int rc; int rc;
unsigned long remain; unsigned long remain;
ulong flags;
mutex_lock(&wil->wmi_mutex); mutex_lock(&wil->wmi_mutex);
spin_lock(&wil->wmi_ev_lock); spin_lock_irqsave(&wil->wmi_ev_lock, flags);
wil->reply_id = reply_id; wil->reply_id = reply_id;
wil->reply_mid = mid; wil->reply_mid = mid;
wil->reply_buf = reply; wil->reply_buf = reply;
wil->reply_size = reply_size; wil->reply_size = reply_size;
reinit_completion(&wil->wmi_call); reinit_completion(&wil->wmi_call);
spin_unlock(&wil->wmi_ev_lock); spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
rc = __wmi_send(wil, cmdid, mid, buf, len); rc = __wmi_send(wil, cmdid, mid, buf, len);
if (rc) if (rc)
@ -1668,12 +1669,12 @@ int wmi_call(struct wil6210_priv *wil, u16 cmdid, u8 mid, void *buf, u16 len,
} }
out: out:
spin_lock(&wil->wmi_ev_lock); spin_lock_irqsave(&wil->wmi_ev_lock, flags);
wil->reply_id = 0; wil->reply_id = 0;
wil->reply_mid = U8_MAX; wil->reply_mid = U8_MAX;
wil->reply_buf = NULL; wil->reply_buf = NULL;
wil->reply_size = 0; wil->reply_size = 0;
spin_unlock(&wil->wmi_ev_lock); spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
mutex_unlock(&wil->wmi_mutex); mutex_unlock(&wil->wmi_mutex);