提交 0d61c917 编写于 作者: T Tim Gardner 提交者: John W. Linville

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@broadcom.com>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: "Franky (Zhenhui) Lin" <frankyl@broadcom.com>
Cc: Hante Meuleman <meuleman@broadcom.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Seth Forshee <seth.forshee@canonical.com>
Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linux-wireless@vger.kernel.org
Cc: brcm80211-dev-list@broadcom.com
Cc: netdev@vger.kernel.org
Signed-off-by: NTim Gardner <tim.gardner@canonical.com>
Acked-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 708eb54f
...@@ -7405,9 +7405,13 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc, ...@@ -7405,9 +7405,13 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
struct brcms_bss_cfg *cfg, struct brcms_bss_cfg *cfg,
bool suspend) bool suspend)
{ {
u16 prb_resp[BCN_TMPL_LEN / 2]; u16 *prb_resp;
int len = BCN_TMPL_LEN; 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 * write the probe response to hardware, or save in
* the config structure * the config structure
...@@ -7441,6 +7445,8 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc, ...@@ -7441,6 +7445,8 @@ brcms_c_bss_update_probe_resp(struct brcms_c_info *wlc,
if (suspend) if (suspend)
brcms_c_enable_mac(wlc); brcms_c_enable_mac(wlc);
kfree(prb_resp);
} }
void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend) void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册