diag: Protect the decrement of number of diag clients
In diagchar_open() protect the decrement of number of diag clients so that there will be no race conditions while reading the value from other functions. Change-Id: I0e2fb5331eec9c7bba39e7d881b69559256833a3 Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
This commit is contained in:
parent
d99718532d
commit
6eb2f4f6fd
1 changed files with 1 additions and 1 deletions
|
@ -389,8 +389,8 @@ static int diagchar_open(struct inode *inode, struct file *file)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
mutex_unlock(&driver->diagchar_mutex);
|
|
||||||
driver->num_clients--;
|
driver->num_clients--;
|
||||||
|
mutex_unlock(&driver->diagchar_mutex);
|
||||||
pr_err_ratelimited("diag: Insufficient memory for new client");
|
pr_err_ratelimited("diag: Insufficient memory for new client");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue