]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
brcmfmac: fix missing checks for kmemdup
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 17:04:32 +0000 (12:04 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837517
[ Upstream commit 46953f97224d56a12ccbe9c6acaa84ca0dab2780 ]

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: Kangjie Lu <kjlu@umn.edu>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

index 9f85eec3d79f4e72a89f9621b00d6349f92ec250..ded629460fc05167c2c1f82a369ab3b8a29d7d78 100644 (file)
@@ -5376,6 +5376,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
                conn_info->req_ie =
                    kmemdup(cfg->extra_buf, conn_info->req_ie_len,
                            GFP_KERNEL);
+               if (!conn_info->req_ie)
+                       conn_info->req_ie_len = 0;
        } else {
                conn_info->req_ie_len = 0;
                conn_info->req_ie = NULL;
@@ -5392,6 +5394,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
                conn_info->resp_ie =
                    kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
                            GFP_KERNEL);
+               if (!conn_info->resp_ie)
+                       conn_info->resp_ie_len = 0;
        } else {
                conn_info->resp_ie_len = 0;
                conn_info->resp_ie = NULL;