aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2015-10-23 17:49:11 -0700
committerRuchi Kandoi <kandoiruchi@google.com>2015-10-26 13:48:07 -0700
commit7653f2e1b3c1d950b2b4df50df8025f604bfd6dc (patch)
treeb3011761c81829f81339f124f3e78979a1a3691b
parent2ccf4f4f216f32541853693d895c2e5fa9cf0d56 (diff)
downloadlinux-linaro-stable-7653f2e1b3c1d950b2b4df50df8025f604bfd6dc.tar.gz
uid_cputime: Check for the range while removing range of UIDs.
Checking if the uid_entry->uid matches the uid intended to be removed will prevent deleting unwanted uid_entry. Type cast the key for the hashtable to the same size, as when they were inserted. This will make sure that we can find the uid_entry we want. Bug: 25195548 Change-Id: I567942123cfb20e4b61ad624da19ec4cc84642c1 Signed-off: Ruchi kandoi <kandoiruchi@google.com>
-rw-r--r--drivers/misc/uid_cputime.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/misc/uid_cputime.c b/drivers/misc/uid_cputime.c
index 43298a43ecc3..c751188ce2ab 100644
--- a/drivers/misc/uid_cputime.c
+++ b/drivers/misc/uid_cputime.c
@@ -174,14 +174,15 @@ static ssize_t uid_remove_write(struct file *file,
kstrtol(end_uid, 10, &uid_end) != 0) {
return -EINVAL;
}
-
mutex_lock(&uid_lock);
for (; uid_start <= uid_end; uid_start++) {
hash_for_each_possible_safe(hash_table, uid_entry, tmp,
- hash, uid_start) {
- hash_del(&uid_entry->hash);
- kfree(uid_entry);
+ hash, (uid_t)uid_start) {
+ if (uid_start == uid_entry->uid) {
+ hash_del(&uid_entry->hash);
+ kfree(uid_entry);
+ }
}
}