From patchwork Wed May 9 12:13:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 10389331 X-Patchwork-Delegate: johannes@sipsolutions.net 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 215BD60153 for ; Wed, 9 May 2018 12:13:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1251B28F46 for ; Wed, 9 May 2018 12:13:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0740528F4A; Wed, 9 May 2018 12:13:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, 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 5569728F46 for ; Wed, 9 May 2018 12:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934727AbeEIMNt (ORCPT ); Wed, 9 May 2018 08:13:49 -0400 Received: from mail.toke.dk ([52.28.52.200]:53245 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932318AbeEIMNt (ORCPT ); Wed, 9 May 2018 08:13:49 -0400 Subject: [PATCH 2/3] staging: Dynamically allocate struct station_info DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1525868025; bh=SPztcSX6YRDx1Nttu6VSOGB9fOiTuFKZyGLPV3CeZ1I=; h=Subject:From:To:Date:In-Reply-To:References:From; b=o6LkGl04nCmcKmkX/0ZP71G9ookX5OtafE9ZutM3CpFRwMgMwUt/chgHv113+PlWf EBP2XKDBY6ZcuhE1S1ZixJ22+NHWovGP0pDSp0sBezIEy/ba9fPw48/eSPXh8IpCYf DilsNFK6Sx1PYWfuqA01Pws/e0SmuGvb22uti3PTA2Z/0M/2nXcfedjbnCrRKGfvXf u08+kI8jOMqti068+q8b0l91Ul67BVKqcatEy1cfK9RYG9Fxh31yl7oRGPrUlzNLKq XK/euesZMjGUdSXrKuWayywPM930PXFgLWBIrtnAzDJRwFdT3m2UPSf6uGVWQPj08f c28kbdh9AO6hQ== From: Toke =?utf-8?q?H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org Date: Wed, 09 May 2018 14:13:45 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <152586802509.18089.14339465375893430540.stgit@alrua-kau> In-Reply-To: <152586802501.18089.2502272945272741154.stgit@alrua-kau> References: <152586802501.18089.2502272945272741154.stgit@alrua-kau> MIME-Version: 1.0 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 Since the addition of the TXQ stats to cfg80211, the station_info struct has grown to be quite large, which results in warnings when allocated on the stack. Fix the affected places to do dynamic allocations instead. WARN_ON is used where the function has no way to signal errors to the caller. This patch applies the fix to the rtl8723bs driver in staging while a separate patch fixes the drivers in the main tree. Fixes: 52539ca89f36 cfg80211: Expose TXQ stats and parameters to userspace Signed-off-by: Toke Høiland-Jørgensen --- drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 46bc2e512557..c76c9a8066c4 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -2431,17 +2431,23 @@ void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(padapter)); { - struct station_info sinfo; + struct station_info *sinfo; u8 ie_offset; if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ) ie_offset = _ASOCREQ_IE_OFFSET_; else /* WIFI_REASSOCREQ */ ie_offset = _REASOCREQ_IE_OFFSET_; - sinfo.filled = 0; - sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset; - sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset; - cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), &sinfo, GFP_ATOMIC); + sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); + if (WARN_ON(!sinfo)) + return; + + sinfo->filled = 0; + sinfo->assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset; + sinfo->assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset; + cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), sinfo, GFP_ATOMIC); + + kfree(sinfo); } }