Merge "diag: Add protection while de-initializing clients"
This commit is contained in:
commit
56b24afda6
1 changed files with 5 additions and 1 deletions
|
@ -1836,14 +1836,18 @@ static int diag_ioctl_lsm_deinit(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
mutex_lock(&driver->diagchar_mutex);
|
||||
for (i = 0; i < driver->num_clients; i++)
|
||||
if (driver->client_map[i].pid == current->tgid)
|
||||
break;
|
||||
|
||||
if (i == driver->num_clients)
|
||||
if (i == driver->num_clients) {
|
||||
mutex_unlock(&driver->diagchar_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
driver->data_ready[i] |= DEINIT_TYPE;
|
||||
mutex_unlock(&driver->diagchar_mutex);
|
||||
wake_up_interruptible(&driver->wait_q);
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue