Skip to content

Commit 8a7d7cb

Browse files
bingzlinvjw
authored andcommitted
mwifiex: fix incomplete scan in case of IE parsing error
A scan request is split into multiple scan commands queued in scan_pending_q. Each scan command will be sent to firmware and its response is handlded one after another. If any error is detected while parsing IE in command response buffer the remaining data will be ignored and error is returned. We should check if there is any more scan commands pending in the queue before returning error. This ensures that we will call cfg80211_scan_done if this is the last scan command, or send next scan command in scan_pending_q to firmware. Cc: "3.6+" <stable@vger.kernel.org> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 0a06ad8 commit 8a7d7cb

File tree

1 file changed

+5
-4
lines changed
  • drivers/net/wireless/mwifiex

1 file changed

+5
-4
lines changed

drivers/net/wireless/mwifiex/scan.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
15631563
dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n",
15641564
scan_rsp->number_of_sets);
15651565
ret = -1;
1566-
goto done;
1566+
goto check_next_scan;
15671567
}
15681568

15691569
bytes_left = le16_to_cpu(scan_rsp->bss_descript_size);
@@ -1634,7 +1634,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
16341634
if (!beacon_size || beacon_size > bytes_left) {
16351635
bss_info += bytes_left;
16361636
bytes_left = 0;
1637-
return -1;
1637+
ret = -1;
1638+
goto check_next_scan;
16381639
}
16391640

16401641
/* Initialize the current working beacon pointer for this BSS
@@ -1690,7 +1691,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
16901691
dev_err(priv->adapter->dev,
16911692
"%s: bytes left < IE length\n",
16921693
__func__);
1693-
goto done;
1694+
goto check_next_scan;
16941695
}
16951696
if (element_id == WLAN_EID_DS_PARAMS) {
16961697
channel = *(current_ptr + sizeof(struct ieee_types_header));
@@ -1753,6 +1754,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
17531754
}
17541755
}
17551756

1757+
check_next_scan:
17561758
spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
17571759
if (list_empty(&adapter->scan_pending_q)) {
17581760
spin_unlock_irqrestore(&adapter->scan_pending_q_lock, flags);
@@ -1813,7 +1815,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
18131815
}
18141816
}
18151817

1816-
done:
18171818
return ret;
18181819
}
18191820

0 commit comments

Comments
 (0)