Commit 68cbfad8 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Greg Kroah-Hartman

staging: r8822be: check kzalloc return or bail

[ Upstream commit e4b08e16 ]

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: default avatarNicholas Mc Guire <hofrat@osadl.org>
Fixes: 938a0447 ("staging: r8822be: Add code for halmac sub-drive")
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c7d9ff45
...@@ -2466,8 +2466,11 @@ halmac_parse_psd_data_88xx(struct halmac_adapter *halmac_adapter, u8 *c2h_buf, ...@@ -2466,8 +2466,11 @@ halmac_parse_psd_data_88xx(struct halmac_adapter *halmac_adapter, u8 *c2h_buf,
segment_size = (u8)PSD_DATA_GET_SEGMENT_SIZE(c2h_buf); segment_size = (u8)PSD_DATA_GET_SEGMENT_SIZE(c2h_buf);
psd_set->data_size = total_size; psd_set->data_size = total_size;
if (!psd_set->data) if (!psd_set->data) {
psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL); psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL);
if (!psd_set->data)
return HALMAC_CMD_PROCESS_ERROR;
}
if (segment_id == 0) if (segment_id == 0)
psd_set->segment_size = segment_size; psd_set->segment_size = segment_size;
......
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