wil6210: drop old event after wmi_call timeout
authorAhmad Masri <amasri@codeaurora.org>
Sun, 16 Jun 2019 07:26:07 +0000 (10:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:13 +0000 (09:14 +0200)
commite54cc89e6f0a4d818cf1ff168851543d6beeaee0
tree1fc682d2cff4b5204f1c9bd1775ad627f0249227
parent0388597d062717d22035a51d2ce15b0a2a79922d
wil6210: drop old event after wmi_call timeout

[ Upstream commit 1a276003111c0404f6bfeffe924c5a21f482428b ]

This change fixes a rare race condition of handling WMI events after
wmi_call expires.

wmi_recv_cmd immediately handles an event when reply_buf is defined and
a wmi_call is waiting for the event.
However, in case the wmi_call has already timed-out, there will be no
waiting/running wmi_call and the event will be queued in WMI queue and
will be handled later in wmi_event_handle.
Meanwhile, a new similar wmi_call for the same command and event may
be issued. In this case, when handling the queued event we got WARN_ON
printed.

Fixing this case as a valid timeout and drop the unexpected event.

Signed-off-by: Ahmad Masri <amasri@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>
drivers/net/wireless/ath/wil6210/wmi.c