Skip to content
Snippets Groups Projects
Commit 9c277354 authored by Ruchi Kandoi's avatar Ruchi Kandoi Committed by Vineeta Srivastava
Browse files

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: I80f8c66c4e3054cafad2a2b1381b0e1ea58f39fc
Signed-off: Ruchi kandoi <kandoiruchi@google.com>
parent 00e4c691
No related branches found
No related tags found
No related merge requests found
...@@ -172,16 +172,17 @@ static ssize_t uid_remove_write(struct file *file, ...@@ -172,16 +172,17 @@ static ssize_t uid_remove_write(struct file *file,
kstrtol(end_uid, 10, &uid_end) != 0) { kstrtol(end_uid, 10, &uid_end) != 0) {
return -EINVAL; return -EINVAL;
} }
mutex_lock(&uid_lock); mutex_lock(&uid_lock);
for (; uid_start <= uid_end; uid_start++) { for (; uid_start <= uid_end; uid_start++) {
hash_for_each_possible_safe(hash_table, uid_entry, tmp, hash_for_each_possible_safe(hash_table, uid_entry, tmp,
hash, uid_start) { hash, (uid_t)uid_start) {
if(uid_start == uid_entry->uid) {
hash_del(&uid_entry->hash); hash_del(&uid_entry->hash);
kfree(uid_entry); kfree(uid_entry);
} }
} }
}
mutex_unlock(&uid_lock); mutex_unlock(&uid_lock);
return count; return count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment