diag: Cleanup client information on deinit Ioctl

Clean up the client pid information from the client table on
lsm_deinit Ioctl call.

Change-Id: Ia40a481b1be909c46371c0bb295db7baa30bdbc8
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
This commit is contained in:
Sreelakshmi Gownipalli 2015-08-13 17:01:41 -07:00 committed by Gerrit - the friendly Code Review server
parent 626a0b85b8
commit fa6505e5b1

View file

@ -443,17 +443,21 @@ static void diag_close_logging_process(int pid)
}
static int diagchar_close(struct inode *inode, struct file *file)
static int diag_remove_client_entry(struct file *file)
{
int i = -1;
struct diagchar_priv *diagpriv_data = file->private_data;
struct diagchar_priv *diagpriv_data = NULL;
struct diag_dci_client_tbl *dci_entry = NULL;
pr_debug("diag: process exit %s\n", current->comm);
if (!(file->private_data)) {
pr_alert("diag: Invalid file pointer");
return -ENOMEM;
if (!file) {
DIAG_LOG(DIAG_DEBUG_USERSPACE, "Invalid file pointer \n");
return -ENOENT;
}
if (!(file->private_data)) {
DIAG_LOG(DIAG_DEBUG_USERSPACE, "Invalid private data \n");
return -EINVAL;
}
diagpriv_data = file->private_data;
if (!driver)
return -ENOMEM;
@ -488,6 +492,11 @@ static int diagchar_close(struct inode *inode, struct file *file)
mutex_unlock(&driver->diagchar_mutex);
return 0;
}
static int diagchar_close(struct inode *inode, struct file *file)
{
DIAG_LOG(DIAG_DEBUG_USERSPACE, "diag: process exit %s\n", current->comm);
return diag_remove_client_entry(file);
}
void diag_record_stats(int type, int flag)
{
@ -2381,7 +2390,9 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count,
data_type = driver->data_ready[index] & DEINIT_TYPE;
COPY_USER_SPACE_OR_EXIT(buf, data_type, 4);
driver->data_ready[index] ^= DEINIT_TYPE;
goto exit;
mutex_unlock(&driver->diagchar_mutex);
diag_remove_client_entry(file);
return ret;
}
if (driver->data_ready[index] & MSG_MASKS_TYPE) {