[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1360268889-52985-1-git-send-email-tim.gardner@canonical.com>
Date: Thu, 7 Feb 2013 13:28:09 -0700
From: Tim Gardner <tim.gardner@...onical.com>
To: linux-kernel@...r.kernel.org
Cc: Tim Gardner <tim.gardner@...onical.com>,
Brett Rudley <brudley@...adcom.com>,
Arend van Spriel <arend@...adcom.com>,
"Franky (Zhenhui) Lin" <frankyl@...adcom.com>,
Hante Meuleman <meuleman@...adcom.com>,
"John W. Linville" <linville@...driver.com>,
Seth Forshee <seth.forshee@...onical.com>,
Pieter-Paul Giesberts <pieterpg@...adcom.com>,
Hauke Mehrtens <hauke@...ke-m.de>,
linux-wireless@...r.kernel.org, brcm80211-dev-list@...adcom.com,
netdev@...r.kernel.org
Subject: [PATCH wireless-next V2] brcmsmac: avoid 512 byte stack variable
Dynamically allocate the probe response template which
avoids potential stack corruption. Observed with smatch:
drivers/net/wireless/brcm80211/brcmsmac/main.c:7412 brcms_c_bss_update_probe_resp()
warn: 'prb_resp' puts 512 bytes on stack
Cc: Brett Rudley <brudley@...adcom.com>
Cc: Arend van Spriel <arend@...adcom.com>
Cc: "Franky (Zhenhui) Lin" <frankyl@...adcom.com>
Cc: Hante Meuleman <meuleman@...adcom.com>
Cc: "John W. Linville" <linville@...driver.com>
Cc: Seth Forshee <seth.forshee@...onical.com>
Cc: Pieter-Paul Giesberts <pieterpg@...adcom.com>
Cc: Hauke Mehrtens <hauke@...ke-m.de>
Cc: linux-wireless@...r.kernel.org
Cc: brcm80211-dev-list@...adcom.com
Cc: netdev@...r.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@...onical.com>
---
drivers/net/wireless/brcm80211/brcmsmac/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index c26992a..ea88abe 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -7408,9 +7408,13 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
struct brcms_bss_cfg *cfg,
bool suspend)
{
- u16 prb_resp[BCN_TMPL_LEN / 2];
+ u16 *prb_resp;
int len = BCN_TMPL_LEN;
+ prb_resp = kmalloc(BCN_TMPL_LEN, GFP_ATOMIC);
+ if (!prb_resp)
+ return;
+
/*
* write the probe response to hardware, or save in
* the config structure
@@ -7444,6 +7448,8 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
if (suspend)
brcms_c_enable_mac(wlc);
+
+ kfree(prb_resp);
}
void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists