Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6eb2f4f6 authored by Sreelakshmi Gownipalli's avatar Sreelakshmi Gownipalli Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarSreelakshmi Gownipalli <sgownipa@codeaurora.org>
parent d9971853
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -389,8 +389,8 @@ static int diagchar_open(struct inode *inode, struct file *file)
	return -ENOMEM;

fail:
	mutex_unlock(&driver->diagchar_mutex);
	driver->num_clients--;
	mutex_unlock(&driver->diagchar_mutex);
	pr_err_ratelimited("diag: Insufficient memory for new client");
	return -ENOMEM;
}