]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging: r8822be: check kzalloc return or bail
authorNicholas Mc Guire <hofrat@osadl.org>
Fri, 15 Feb 2019 09:24:22 +0000 (10:24 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit e4b08e16b7d9d030b6475ef48f94d734a39f3c81 ]

The kzalloc() in halmac_parse_psd_data_88xx() can fail and return NULL
so check the psd_set->data after allocation and if allocation failed
return HALMAC_CMD_PROCESS_ERROR.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 938a0447f094 ("staging: r8822be: Add code for halmac sub-drive")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c

index c4cb217d3d1fe77494b96221695e0a5fd64edccb..d225d832fb363dc981641e993b3857bb8d6c6892 100644 (file)
@@ -2477,8 +2477,11 @@ halmac_parse_psd_data_88xx(struct halmac_adapter *halmac_adapter, u8 *c2h_buf,
        segment_size = (u8)PSD_DATA_GET_SEGMENT_SIZE(c2h_buf);
        psd_set->data_size = total_size;
 
-       if (!psd_set->data)
+       if (!psd_set->data) {
                psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL);
+               if (!psd_set->data)
+                       return HALMAC_CMD_PROCESS_ERROR;
+       }
 
        if (segment_id == 0)
                psd_set->segment_size = segment_size;