mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
msm: mhi_dev: Avoiding null pointer dereference in uci layer
Avoiding null pointer dereference in mhi_uci_client_open API in uci layer by changing the location of the condition check for uci_handle. Change-Id: If2cc99f47f4c5d05d0df4a5b4900894683f7c8d1 Signed-off-by: Sai Chaitanya Kaveti <quic_skaveti@quicinc.com>
This commit is contained in:
parent
a7cdb778e4
commit
1bcfee37cb
1 changed files with 5 additions and 6 deletions
|
|
@ -1081,17 +1081,16 @@ static int mhi_uci_client_open(struct inode *mhi_inode,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!uci_handle) {
|
||||
uci_log(UCI_DBG_DBG, "No memory, returning failure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mutex_lock(&uci_handle->client_lock);
|
||||
uci_log(UCI_DBG_DBG,
|
||||
"Client opened struct device node 0x%x, ref count 0x%x\n",
|
||||
iminor(mhi_inode), atomic_read(&uci_handle->ref_count));
|
||||
if (atomic_add_return(1, &uci_handle->ref_count) == 1) {
|
||||
if (!uci_handle) {
|
||||
atomic_dec(&uci_handle->ref_count);
|
||||
uci_log(UCI_DBG_DBG, "No memory, returning failure\n");
|
||||
mutex_unlock(&uci_handle->client_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
uci_handle->uci_ctxt = &uci_ctxt;
|
||||
uci_handle->f_flags = file_handle->f_flags;
|
||||
if (!atomic_read(&uci_handle->mhi_chans_open)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue