diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2014-03-20 22:50:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-03-31 13:47:40 -0400 |
commit | 1845bd3a91427b4715ff0e28719fa4a4b9003f23 (patch) | |
tree | 0fd54b5b2c643dc332e213ec9b827ac28d83a164 /drivers/net/wireless/mwifiex/scan.c | |
parent | 9d2ffb81608da30c3293fb7e20474358a5951cca (diff) |
mwifiex: scan command preparation failure handling
When scan request is received, scan commands are prepared and
queued into scan pending queue. There is a corner case when
command nodes are full. So we stop queueing further scan
commands and return an error. This patch makes sure that
currently queued commands in scan pending queue are also freed
in this case.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 4e6e75c2de0c..e496497a7af0 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -591,10 +591,12 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, | |||
591 | *chan_tlv_out, | 591 | *chan_tlv_out, |
592 | struct mwifiex_chan_scan_param_set *scan_chan_list) | 592 | struct mwifiex_chan_scan_param_set *scan_chan_list) |
593 | { | 593 | { |
594 | struct mwifiex_adapter *adapter = priv->adapter; | ||
594 | int ret = 0; | 595 | int ret = 0; |
595 | struct mwifiex_chan_scan_param_set *tmp_chan_list; | 596 | struct mwifiex_chan_scan_param_set *tmp_chan_list; |
596 | struct mwifiex_chan_scan_param_set *start_chan; | 597 | struct mwifiex_chan_scan_param_set *start_chan; |
597 | 598 | struct cmd_ctrl_node *cmd_node, *tmp_node; | |
599 | unsigned long flags; | ||
598 | u32 tlv_idx, rates_size, cmd_no; | 600 | u32 tlv_idx, rates_size, cmd_no; |
599 | u32 total_scan_time; | 601 | u32 total_scan_time; |
600 | u32 done_early; | 602 | u32 done_early; |
@@ -748,8 +750,19 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, | |||
748 | scan_cfg_out->tlv_buf_len -= | 750 | scan_cfg_out->tlv_buf_len -= |
749 | sizeof(struct mwifiex_ie_types_header) + rates_size; | 751 | sizeof(struct mwifiex_ie_types_header) + rates_size; |
750 | 752 | ||
751 | if (ret) | 753 | if (ret) { |
754 | spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); | ||
755 | list_for_each_entry_safe(cmd_node, tmp_node, | ||
756 | &adapter->scan_pending_q, | ||
757 | list) { | ||
758 | list_del(&cmd_node->list); | ||
759 | cmd_node->wait_q_enabled = false; | ||
760 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); | ||
761 | } | ||
762 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | ||
763 | flags); | ||
752 | break; | 764 | break; |
765 | } | ||
753 | } | 766 | } |
754 | 767 | ||
755 | if (ret) | 768 | if (ret) |