diff mbox

mwifiex: double the size of chan_stats array in adapter

Message ID 1507118766-17713-1-git-send-email-gbhat@marvell.com (mailing list archive)
State Accepted
Commit 2d5cc60949e0d2de3cb05d5772b58a5aa7f4abc3
Delegated to: Kalle Valo
Headers show

Commit Message

Ganapathi Bhat Oct. 4, 2017, 12:06 p.m. UTC
From: Rohit Fule <rohitf@marvell.com>

When a user requests scan, driver sends multiple scan requests
to firmware, which might be active or passive. Firmware will
send channel statistics for each channel in the request. This will
be stored in chan_stats array.

Few channels might report hidden SSIDs in passive scan results.
So, once the original scan request is finished, driver issues an
active scan request for all channels which reported hidden SSIDs.
This will cause duplicates in the chan_stats array. At worst,
every channel will have a hidden SSID, in which case the driver
can issue active scan requests for each channel. So the complete
scan statistics size will be twice of existing limit.

At present maximum number of channels returned in scan statistics
is 31(BG) + 14(A) = 45. Clearly there will be an overflow of the
chan_stats array in the above mentioned scenario. To fix this
double the size of chan_stats array.

Signed-off-by: Rohit Fule <rohitf@marvell.com>
Signed-off-by: Mangesh Malusare <mmangesh@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Kalle Valo Oct. 13, 2017, 9:39 a.m. UTC | #1
Ganapathi Bhat <gbhat@marvell.com> wrote:

> From: Rohit Fule <rohitf@marvell.com>
> 
> When a user requests scan, driver sends multiple scan requests
> to firmware, which might be active or passive. Firmware will
> send channel statistics for each channel in the request. This will
> be stored in chan_stats array.
> 
> Few channels might report hidden SSIDs in passive scan results.
> So, once the original scan request is finished, driver issues an
> active scan request for all channels which reported hidden SSIDs.
> This will cause duplicates in the chan_stats array. At worst,
> every channel will have a hidden SSID, in which case the driver
> can issue active scan requests for each channel. So the complete
> scan statistics size will be twice of existing limit.
> 
> At present maximum number of channels returned in scan statistics
> is 31(BG) + 14(A) = 45. Clearly there will be an overflow of the
> chan_stats array in the above mentioned scenario. To fix this
> double the size of chan_stats array.
> 
> Signed-off-by: Rohit Fule <rohitf@marvell.com>
> Signed-off-by: Mangesh Malusare <mmangesh@marvell.com>
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>

Patch applied to wireless-drivers-next.git, thanks.

2d5cc60949e0 mwifiex: double the size of chan_stats array in adapter
diff mbox

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index ac01af4..f33ed79 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4201,7 +4201,10 @@  int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter)
 	if (adapter->config_bands & BAND_A)
 		n_channels_a = mwifiex_band_5ghz.n_channels;
 
-	adapter->num_in_chan_stats = n_channels_bg + n_channels_a;
+	/* allocate twice the number total channels, since the driver issues an
+	 * additional active scan request for hidden SSIDs on passive channels.
+	 */
+	adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a);
 	adapter->chan_stats = vmalloc(sizeof(*adapter->chan_stats) *
 				      adapter->num_in_chan_stats);