From patchwork Wed Oct 4 12:06:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapathi Bhat X-Patchwork-Id: 9984471 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B0A36028E for ; Wed, 4 Oct 2017 12:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F1DC28ADD for ; Wed, 4 Oct 2017 12:10:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2359A28ADF; Wed, 4 Oct 2017 12:10:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9672228ADD for ; Wed, 4 Oct 2017 12:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752040AbdJDMKD (ORCPT ); Wed, 4 Oct 2017 08:10:03 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:33326 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752015AbdJDMKB (ORCPT ); Wed, 4 Oct 2017 08:10:01 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v94C9qED015485; Wed, 4 Oct 2017 05:09:59 -0700 Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2dc65sahfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 04 Oct 2017 05:09:59 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 4 Oct 2017 05:09:58 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Wed, 4 Oct 2017 05:09:58 -0700 Received: from localhost (gbhat-thinkpad-t430.marvell.com [10.31.130.81]) by maili.marvell.com (Postfix) with ESMTP id 623473F7040; Wed, 4 Oct 2017 05:09:58 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by localhost (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id v94C78BW017751; Wed, 4 Oct 2017 17:37:08 +0530 Received: (from root@localhost) by localhost (8.14.4/8.14.4/Submit) id v94C77q7017749; Wed, 4 Oct 2017 17:37:07 +0530 From: Ganapathi Bhat To: CC: Brian Norris , Cathy Luo , Xinming Hu , Zhiyuan Yang , James Cao , Mangesh Malusare , Rohit Fule , Ganapathi Bhat Subject: [PATCH] mwifiex: double the size of chan_stats array in adapter Date: Wed, 4 Oct 2017 17:36:06 +0530 Message-ID: <1507118766-17713-1-git-send-email-gbhat@marvell.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-04_06:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710040175 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rohit Fule 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 Signed-off-by: Mangesh Malusare Signed-off-by: Ganapathi Bhat --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);