diff options
| author | Naresh Malladi <namall@codeaurora.org> | 2017-06-05 21:45:45 +0530 |
|---|---|---|
| committer | Naresh Malladi <namall@codeaurora.org> | 2017-06-05 21:54:01 +0530 |
| commit | c3857df8a31d5f4e0d429bf02ccdbfd331c1c80e (patch) | |
| tree | 29f114d6d60c4e59a42ab2b3c1567b46129be6bf /net/unix/af_unix.c | |
| parent | 6666999e8af86c25d7fdcf553164d53d978961fc (diff) | |
drivers: soc: qcom: rpm_stats: Add mutex lock for shared data
The buffer allocated in file open operations need to be
protected as there can be a possiblity of use-after-free
scenario.
Process A B
| |
open |
| |
read started |
| close
Add mutex lock to protect the buffer to avoid this.
"msm_rpmstats_copy_stats" accesses the variable "pdata->read_idx"
without locking. The userspace can invoke the "read" call from
multiple threads which will call "msm_rpmstats_file_read" which
in turn calls "msm_rpmstats_copy_stats".
This can allow the statement "pdata->read_idx++" increment
"read_idx" beyond the limit ("prvdata->num_records") and call
"msm_rpmstats_read_register" with this value.
Also allow reading RPM stats information using sysfs nodes.
The stats are available at
/sys/power/system_sleep/stats
Change-Id: I031f02bb2694a97ced86da0a9f54d0e434e4ad6d
Signed-off-by: Naresh Malladi <namall@codeaurora.org>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions
