diff options
author | Hante Meuleman <meuleman@broadcom.com> | 2015-03-06 12:40:41 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-03-13 09:16:36 -0400 |
commit | d375bc8a85a49bf4d2897f59fab4d4afb34d5d44 (patch) | |
tree | ca76b8c7b6d4fd137b9e49d11014cf485bfacea9 | |
parent | 449e58b85c0051117bf8428777b4ae38e098506a (diff) |
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>
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c index 6262612dec45..4ec9811f49c8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | |||
@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(struct brcmf_msgbuf *msgbuf) | |||
481 | 481 | ||
482 | static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf) | 482 | static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf) |
483 | { | 483 | { |
484 | if (waitqueue_active(&msgbuf->ioctl_resp_wait)) { | 484 | msgbuf->ctl_completed = true; |
485 | msgbuf->ctl_completed = true; | 485 | if (waitqueue_active(&msgbuf->ioctl_resp_wait)) |
486 | wake_up(&msgbuf->ioctl_resp_wait); | 486 | wake_up(&msgbuf->ioctl_resp_wait); |
487 | } | ||
488 | } | 487 | } |
489 | 488 | ||
490 | 489 | ||