mem-buf-gh: Do not deref xfer_mem fields on error
If we fail to allocate an xfer_mem object, do not dereference its fields. Change-Id: I6a86d86df384988568ce2e1a4966926171cf33ea Signed-off-by: Sukadev Bhattiprolu <quic_sukadev@quicinc.com> Signed-off-by: Vijayanand Jitta <quic_vjitta@quicinc.com>
This commit is contained in:
parent
8c23e656bc
commit
0e31b12a06
@ -630,6 +630,7 @@ static void mem_buf_alloc_req_work(struct work_struct *work)
|
||||
ret = PTR_ERR(xfer_mem);
|
||||
pr_err("%s: failed to process rmt memory alloc request: %d\n",
|
||||
__func__, ret);
|
||||
xfer_mem = NULL;
|
||||
} else {
|
||||
resp_msg->hdl = xfer_mem->hdl;
|
||||
resp_msg->obj_id = xfer_mem->obj_id;
|
||||
@ -649,10 +650,12 @@ static void mem_buf_alloc_req_work(struct work_struct *work)
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to send memory allocation response rc: %d\n",
|
||||
__func__, ret);
|
||||
mutex_lock(&mem_buf_xfer_mem_list_lock);
|
||||
list_del(&xfer_mem->entry);
|
||||
mutex_unlock(&mem_buf_xfer_mem_list_lock);
|
||||
mem_buf_cleanup_alloc_req(xfer_mem, xfer_mem->hdl);
|
||||
if (xfer_mem) {
|
||||
mutex_lock(&mem_buf_xfer_mem_list_lock);
|
||||
list_del(&xfer_mem->entry);
|
||||
mutex_unlock(&mem_buf_xfer_mem_list_lock);
|
||||
mem_buf_cleanup_alloc_req(xfer_mem, xfer_mem->hdl);
|
||||
}
|
||||
} else {
|
||||
pr_debug("%s: Allocation response sent\n", __func__);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user