qcacmn: Fix possible NULL dereference in apf read
While processing WMI_BPF_GET_VDEV_WORK_MEMORY_RESP_EVENTID, in wma_apf_read_work_memory_event_handler() apf read callback is invoked after wmi_extract_apf_read_memory_resp_event_tlv(). During extraction of apf attributes there is no NULL check of data tlv when data length is non-zero. If the firmware message is wrongly crafted with non-zero length in fixed param and NULL data then NULL pointer dereference is seen in apf read callback. To address this, avoid copy when data is NULL and data length is non-zero. Change-Id: Ie054c487ead5c929e5a293651a65383d6f87dc71 CRs-Fixed: 2446019
This commit is contained in:

committed by
nshrivas

parent
f90c944dad
commit
f3ed004380
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -216,10 +216,11 @@ wmi_extract_apf_read_memory_resp_event_tlv(wmi_unified_t wmi_handle,
|
||||
param_buf->num_data);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
resp->length = data_event->length;
|
||||
|
||||
if (resp->length)
|
||||
if (data_event->length && param_buf->data) {
|
||||
resp->length = data_event->length;
|
||||
resp->data = (uint8_t *)param_buf->data;
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user