]> git.baikalelectronics.ru Git - kernel.git/commit
wil6210: protect synchronous wmi commands handling
authorMaya Erez <qca_merez@qca.qualcomm.com>
Thu, 28 Jan 2016 17:24:04 +0000 (19:24 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 2 Feb 2016 12:05:58 +0000 (14:05 +0200)
commit55db72c6ea9094062724bfac4f093bd7f497927e
tree15750927bce554ae44b86f746d1fedef40025d6e
parent9cae3e24c8116f7511c3d08e5edd34f89246683b
wil6210: protect synchronous wmi commands handling

In case there are multiple WMI commands with the same reply_id,
the following scenario can occur:
- Driver sends the first command to the device
- The reply didn’t get on time and there is timeout
- Reply_id, reply_buf and reply_size are set to 0
- Driver sends second wmi command with the same reply_id as the first
- Driver sets wil->reply_id
- Reply for the first wmi command arrives and handled by wmi_recv_cmd
- As its ID fits the reply_id but the reply_buf is not set yet it is
handled as a reply with event handler, and WARN_ON is printed

This patch guarantee atomic setting of all the reply variables and
prevents the above scenario.

Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wil6210/wmi.c