Merge "msm: mhi_dev: Avoiding null pointer dereference in uci layer"

This commit is contained in:
qctecmdr 2022-06-24 06:14:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit 582043ac51

View file

@ -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)) {