Commit d647661f authored by Kangjie Lu's avatar Kangjie Lu Committed by Greg Kroah-Hartman

brcmfmac: fix missing checks for kmemdup

[ Upstream commit 46953f97 ]

In case kmemdup fails, the fix sets conn_info->req_ie_len and
conn_info->resp_ie_len to zero to avoid buffer overflows.
Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
Acked-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5ff8545c
...@@ -5374,6 +5374,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, ...@@ -5374,6 +5374,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
conn_info->req_ie = conn_info->req_ie =
kmemdup(cfg->extra_buf, conn_info->req_ie_len, kmemdup(cfg->extra_buf, conn_info->req_ie_len,
GFP_KERNEL); GFP_KERNEL);
if (!conn_info->req_ie)
conn_info->req_ie_len = 0;
} else { } else {
conn_info->req_ie_len = 0; conn_info->req_ie_len = 0;
conn_info->req_ie = NULL; conn_info->req_ie = NULL;
...@@ -5390,6 +5392,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, ...@@ -5390,6 +5392,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
conn_info->resp_ie = conn_info->resp_ie =
kmemdup(cfg->extra_buf, conn_info->resp_ie_len, kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
GFP_KERNEL); GFP_KERNEL);
if (!conn_info->resp_ie)
conn_info->resp_ie_len = 0;
} else { } else {
conn_info->resp_ie_len = 0; conn_info->resp_ie_len = 0;
conn_info->resp_ie = NULL; conn_info->resp_ie = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment