]> git.baikalelectronics.ru Git - kernel.git/commit
mwifiex: fix negative cmd_pending count
authorBing Zhao <bzhao@marvell.com>
Mon, 1 Apr 2013 19:44:46 +0000 (12:44 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Apr 2013 19:28:37 +0000 (15:28 -0400)
commit7deeb9b94c3002c0b85394e09ca87f437da41981
tree6361c56ff62efdeccfaa95ba52069eb42721bd00
parent71309e44213b0bdba57bc27cda52f9fe90e727b3
mwifiex: fix negative cmd_pending count

cmd_pending is increased in mwifiex_wait_queue_complete() and
decreased in mwifiex_complete_cmd() currently.
If there are two or more commands in the cmd_pending_q the main
worker thread will pick up next command from cmd_pending_q
automatically after finishing current command. As a result
mwifiex_wait_queue_complete() will not be called because
the command is alreay completed. This leads to a negative
number in cmd_pending count.

Fix it by increasing cmd_pending when a cmd is queued into
cmd_pending_q and decreasing when that cmd is recycled. For scan
commands we don't perform inc/dec operations until it's moved
from scan_pending_q to cmd_pending_q. This covers both
synchronous and asynchronous commands.

Reported-by: Daniel Drake <dsd@laptop.org>
Tested-by: Daniel Drake <dsd@laptop.org>
Tested-by: Marco Cesarano <marco@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cmdevt.c
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_cmdresp.c
drivers/net/wireless/mwifiex/sta_ioctl.c
drivers/net/wireless/mwifiex/util.c