brcmfmac: Fix race condition in msgbuf ioctl processing.
authorHante Meuleman <meuleman@broadcom.com>
Fri, 6 Mar 2015 17:40:41 +0000 (18:40 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 13 Mar 2015 13:16:36 +0000 (15:16 +0200)
commitd375bc8a85a49bf4d2897f59fab4d4afb34d5d44
treeca76b8c7b6d4fd137b9e49d11014cf485bfacea9
parent449e58b85c0051117bf8428777b4ae38e098506a
brcmfmac: Fix race condition in msgbuf ioctl processing.

Msgbuf is using a wait_event_timeout to wait for the response on
an ioctl. The wakeup routine uses waitqueue_active to see if
wait_event_timeout has been called. There is a chance that the
response arrives before wait_event_timeout is called, this
will result in situation that wait_event_timeout never gets
woken again and assumed result will be a timeout. This patch
removes that errornous situation by always setting the
ctl_completed var before checking for queue active.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c