Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lineage misc fixes #46

Merged
merged 7 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions drivers/char/adsprpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2328,11 +2328,13 @@ static int fastrpc_internal_munmap(struct fastrpc_file *fl,
VERIFY(err, !fastrpc_mmap_remove(fl, ud->vaddrout, ud->size, &map));
if (err)
goto bail;
VERIFY(err, !fastrpc_munmap_on_dsp(fl, map->raddr,
map->phys, map->size, map->flags));
if (err)
goto bail;
fastrpc_mmap_free(map);
if (map) {
VERIFY(err, !fastrpc_munmap_on_dsp(fl, map->raddr,
map->phys, map->size, map->flags));
if (err)
goto bail;
fastrpc_mmap_free(map);
}
bail:
if (err && map)
fastrpc_mmap_add(map);
Expand Down
1 change: 1 addition & 0 deletions drivers/char/diag/diag_dci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3157,6 +3157,7 @@ int diag_dci_register_client(struct diag_dci_reg_tbl_t *reg_entry)
kfree(new_entry);
new_entry = NULL;
}
put_task_struct(current);
mutex_unlock(&driver->dci_mutex);
return DIAG_DCI_NO_REG;
}
Expand Down
34 changes: 20 additions & 14 deletions drivers/cpufreq/cpufreq_times.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ static void *uid_seq_start(struct seq_file *seq, loff_t *pos)

static void *uid_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
(*pos)++;
do {
(*pos)++;

if (*pos >= HASH_SIZE(uid_hash_table))
return NULL;
if (*pos >= HASH_SIZE(uid_hash_table))
return NULL;
} while (hlist_empty(&uid_hash_table[*pos]));

return &uid_hash_table[*pos];
}
Expand All @@ -220,7 +222,8 @@ static int uid_time_in_state_seq_show(struct seq_file *m, void *v)
if (freqs->freq_table[i] ==
CPUFREQ_ENTRY_INVALID)
continue;
seq_printf(m, " %d", freqs->freq_table[i]);
seq_put_decimal_ull(m, " ",
freqs->freq_table[i]);
}
}
seq_putc(m, '\n');
Expand All @@ -229,13 +232,16 @@ static int uid_time_in_state_seq_show(struct seq_file *m, void *v)
rcu_read_lock();

hlist_for_each_entry_rcu(uid_entry, (struct hlist_head *)v, hash) {
if (uid_entry->max_state)
seq_printf(m, "%d:", uid_entry->uid);
if (uid_entry->max_state) {
seq_put_decimal_ull(m, "", uid_entry->uid);
seq_putc(m, ':');
}
for (i = 0; i < uid_entry->max_state; ++i) {
u64 time;
if (freq_index_invalid(i))
continue;
seq_printf(m, " %lu", (unsigned long)cputime_to_clock_t(
uid_entry->time_in_state[i]));
time = cputime_to_clock_t(uid_entry->time_in_state[i]);
seq_put_decimal_ull(m, " ", time);
}
if (uid_entry->max_state)
seq_putc(m, '\n');
Expand All @@ -256,13 +262,13 @@ static int concurrent_time_seq_show(struct seq_file *m, void *v,
hlist_for_each_entry_rcu(uid_entry, (struct hlist_head *)v, hash) {
atomic64_t *times = get_times(uid_entry->concurrent_times);

seq_put_decimal_ull(m, 0, (u64)uid_entry->uid);
seq_put_decimal_ull(m, "", (u64)uid_entry->uid);
seq_putc(m, ':');

for (i = 0; i < num_possible_cpus; ++i) {
u64 time = cputime_to_clock_t(atomic64_read(&times[i]));

seq_put_decimal_ull(m, ' ', time);
seq_put_decimal_ull(m, " ", time);
}
seq_putc(m, '\n');
}
Expand All @@ -280,7 +286,7 @@ static inline atomic64_t *get_active_times(struct concurrent_times *times)
static int concurrent_active_time_seq_show(struct seq_file *m, void *v)
{
if (v == uid_hash_table) {
seq_printf(m, "cpus: %d", num_possible_cpus());
seq_put_decimal_ull(m, "cpus: ", num_possible_cpus());
seq_putc(m, '\n');
}

Expand All @@ -306,18 +312,18 @@ static int concurrent_policy_time_seq_show(struct seq_file *m, void *v)
continue;
if (freqs != last_freqs) {
if (last_freqs) {
seq_printf(m, ": %d", cnt);
seq_put_decimal_ull(m, ": ", cnt);
seq_putc(m, ' ');
cnt = 0;
}
seq_printf(m, "policy%d", i);
seq_put_decimal_ull(m, "policy", i);

last_freqs = freqs;
}
cnt++;
}
if (last_freqs) {
seq_printf(m, ": %d", cnt);
seq_put_decimal_ull(m, ": ", cnt);
seq_putc(m, '\n');
}
}
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3116,7 +3116,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)

err = ufshcd_map_sg(lrbp);
if (err) {
ufshcd_release(hba, false);
lrbp->cmd = NULL;
clear_bit_unlock(tag, &hba->lrb_in_use);
ufshcd_release_all(hba);
Expand Down
189 changes: 92 additions & 97 deletions fs/proc/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,51 +169,45 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
task_unlock(p);
rcu_read_unlock();

seq_printf(m,
"State:\t%s\n"
"Tgid:\t%d\n"
"Pid:\t%d\n"
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
"Gid:\t%d\t%d\t%d\t%d\n"
"Ngid:\t%d\n"
"FDSize:\t%d\nGroups:\t",
get_task_state(p),
tgid, pid_nr_ns(pid, ns), ppid, tpid,
from_kuid_munged(user_ns, cred->uid),
from_kuid_munged(user_ns, cred->euid),
from_kuid_munged(user_ns, cred->suid),
from_kuid_munged(user_ns, cred->fsuid),
from_kgid_munged(user_ns, cred->gid),
from_kgid_munged(user_ns, cred->egid),
from_kgid_munged(user_ns, cred->sgid),
from_kgid_munged(user_ns, cred->fsgid),
ngid, max_fds);

seq_printf(m, "State:\t%s", get_task_state(p));

seq_put_decimal_ull(m, "\nTgid:\t", tgid);
seq_put_decimal_ull(m, "\nPid:\t", pid_nr_ns(pid, ns));
seq_put_decimal_ull(m, "\nPPid:\t", ppid);
seq_put_decimal_ull(m, "\nTracerPid:\t", tpid);
seq_put_decimal_ull(m, "\nUid:\t", from_kuid_munged(user_ns, cred->uid));
seq_put_decimal_ull(m, "\t", from_kuid_munged(user_ns, cred->euid));
seq_put_decimal_ull(m, "\t", from_kuid_munged(user_ns, cred->suid));
seq_put_decimal_ull(m, "\t", from_kuid_munged(user_ns, cred->fsuid));
seq_put_decimal_ull(m, "\nGid:\t", from_kgid_munged(user_ns, cred->gid));
seq_put_decimal_ull(m, "\t", from_kgid_munged(user_ns, cred->egid));
seq_put_decimal_ull(m, "\t", from_kgid_munged(user_ns, cred->sgid));
seq_put_decimal_ull(m, "\t", from_kgid_munged(user_ns, cred->fsgid));
seq_put_decimal_ull(m, "\nNgid:\t", ngid);
seq_put_decimal_ull(m, "\nFDSize:\t", max_fds);

seq_puts(m, "\nGroups:\t");
group_info = cred->group_info;
for (g = 0; g < group_info->ngroups; g++)
seq_printf(m, "%d ",
from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
seq_put_decimal_ull(m, g ? " " : "",
from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
put_cred(cred);
/* Trailing space shouldn't have been added in the first place. */
seq_putc(m, ' ');

#ifdef CONFIG_PID_NS
seq_puts(m, "\nNStgid:");
for (g = ns->level; g <= pid->level; g++)
seq_printf(m, "\t%d",
task_tgid_nr_ns(p, pid->numbers[g].ns));
seq_put_decimal_ull(m, "\t", task_tgid_nr_ns(p, pid->numbers[g].ns));
seq_puts(m, "\nNSpid:");
for (g = ns->level; g <= pid->level; g++)
seq_printf(m, "\t%d",
task_pid_nr_ns(p, pid->numbers[g].ns));
seq_put_decimal_ull(m, "\t", task_pid_nr_ns(p, pid->numbers[g].ns));
seq_puts(m, "\nNSpgid:");
for (g = ns->level; g <= pid->level; g++)
seq_printf(m, "\t%d",
task_pgrp_nr_ns(p, pid->numbers[g].ns));
seq_put_decimal_ull(m, "\t", task_pgrp_nr_ns(p, pid->numbers[g].ns));
seq_puts(m, "\nNSsid:");
for (g = ns->level; g <= pid->level; g++)
seq_printf(m, "\t%d",
task_session_nr_ns(p, pid->numbers[g].ns));
seq_put_decimal_ull(m, "\t", task_session_nr_ns(p, pid->numbers[g].ns));
#endif
seq_putc(m, '\n');
}
Expand Down Expand Up @@ -282,11 +276,12 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
unlock_task_sighand(p, &flags);
}

seq_printf(m, "Threads:\t%d\n", num_threads);
seq_printf(m, "SigQ:\t%lu/%lu\n", qsize, qlim);
seq_put_decimal_ull(m, "Threads:\t", num_threads);
seq_put_decimal_ull(m, "\nSigQ:\t", qsize);
seq_put_decimal_ull(m, "/", qlim);

/* render them all */
render_sigset_t(m, "SigPnd:\t", &pending);
render_sigset_t(m, "\nSigPnd:\t", &pending);
render_sigset_t(m, "ShdPnd:\t", &shpending);
render_sigset_t(m, "SigBlk:\t", &blocked);
render_sigset_t(m, "SigIgn:\t", &ignored);
Expand Down Expand Up @@ -331,7 +326,8 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
{
#ifdef CONFIG_SECCOMP
seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode);
seq_put_decimal_ull(m, "Seccomp:\t", p->seccomp.mode);
seq_putc(m, '\n');
#endif
seq_printf(m, "Speculation_Store_Bypass:\t");
switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) {
Expand Down Expand Up @@ -363,10 +359,9 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
static inline void task_context_switch_counts(struct seq_file *m,
struct task_struct *p)
{
seq_printf(m, "voluntary_ctxt_switches:\t%lu\n"
"nonvoluntary_ctxt_switches:\t%lu\n",
p->nvcsw,
p->nivcsw);
seq_put_decimal_ull(m, "voluntary_ctxt_switches:\t", p->nvcsw);
seq_put_decimal_ull(m, "\nnonvoluntary_ctxt_switches:\t", p->nivcsw);
seq_putc(m, '\n');
}

static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
Expand Down Expand Up @@ -510,41 +505,41 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
start_time = nsec_to_clock_t(task->real_start_time);

seq_printf(m, "%d (%s) %c", pid_nr_ns(pid, ns), tcomm, state);
seq_put_decimal_ll(m, ' ', ppid);
seq_put_decimal_ll(m, ' ', pgid);
seq_put_decimal_ll(m, ' ', sid);
seq_put_decimal_ll(m, ' ', tty_nr);
seq_put_decimal_ll(m, ' ', tty_pgrp);
seq_put_decimal_ull(m, ' ', task->flags);
seq_put_decimal_ull(m, ' ', min_flt);
seq_put_decimal_ull(m, ' ', cmin_flt);
seq_put_decimal_ull(m, ' ', maj_flt);
seq_put_decimal_ull(m, ' ', cmaj_flt);
seq_put_decimal_ull(m, ' ', cputime_to_clock_t(utime));
seq_put_decimal_ull(m, ' ', cputime_to_clock_t(stime));
seq_put_decimal_ll(m, ' ', cputime_to_clock_t(cutime));
seq_put_decimal_ll(m, ' ', cputime_to_clock_t(cstime));
seq_put_decimal_ll(m, ' ', priority);
seq_put_decimal_ll(m, ' ', nice);
seq_put_decimal_ll(m, ' ', num_threads);
seq_put_decimal_ull(m, ' ', 0);
seq_put_decimal_ull(m, ' ', start_time);
seq_put_decimal_ull(m, ' ', vsize);
seq_put_decimal_ull(m, ' ', mm ? get_mm_rss(mm) : 0);
seq_put_decimal_ull(m, ' ', rsslim);
seq_put_decimal_ull(m, ' ', mm ? (permitted ? mm->start_code : 1) : 0);
seq_put_decimal_ull(m, ' ', mm ? (permitted ? mm->end_code : 1) : 0);
seq_put_decimal_ull(m, ' ', (permitted && mm) ? mm->start_stack : 0);
seq_put_decimal_ull(m, ' ', esp);
seq_put_decimal_ull(m, ' ', eip);
seq_put_decimal_ll(m, " ", ppid);
seq_put_decimal_ll(m, " ", pgid);
seq_put_decimal_ll(m, " ", sid);
seq_put_decimal_ll(m, " ", tty_nr);
seq_put_decimal_ll(m, " ", tty_pgrp);
seq_put_decimal_ull(m, " ", task->flags);
seq_put_decimal_ull(m, " ", min_flt);
seq_put_decimal_ull(m, " ", cmin_flt);
seq_put_decimal_ull(m, " ", maj_flt);
seq_put_decimal_ull(m, " ", cmaj_flt);
seq_put_decimal_ull(m, " ", cputime_to_clock_t(utime));
seq_put_decimal_ull(m, " ", cputime_to_clock_t(stime));
seq_put_decimal_ll(m, " ", cputime_to_clock_t(cutime));
seq_put_decimal_ll(m, " ", cputime_to_clock_t(cstime));
seq_put_decimal_ll(m, " ", priority);
seq_put_decimal_ll(m, " ", nice);
seq_put_decimal_ll(m, " ", num_threads);
seq_put_decimal_ull(m, " ", 0);
seq_put_decimal_ull(m, " ", start_time);
seq_put_decimal_ull(m, " ", vsize);
seq_put_decimal_ull(m, " ", mm ? get_mm_rss(mm) : 0);
seq_put_decimal_ull(m, " ", rsslim);
seq_put_decimal_ull(m, " ", mm ? (permitted ? mm->start_code : 1) : 0);
seq_put_decimal_ull(m, " ", mm ? (permitted ? mm->end_code : 1) : 0);
seq_put_decimal_ull(m, " ", (permitted && mm) ? mm->start_stack : 0);
seq_put_decimal_ull(m, " ", esp);
seq_put_decimal_ull(m, " ", eip);
/* The signal information here is obsolete.
* It must be decimal for Linux 2.0 compatibility.
* Use /proc/#/status for real-time signals.
*/
seq_put_decimal_ull(m, ' ', task->pending.signal.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, " ", task->pending.signal.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, " ", task->blocked.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, " ", sigign.sig[0] & 0x7fffffffUL);
seq_put_decimal_ull(m, " ", sigcatch.sig[0] & 0x7fffffffUL);

/*
* We used to output the absolute kernel address, but that's an
Expand All @@ -558,31 +553,31 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
else
seq_puts(m, " 0");

seq_put_decimal_ull(m, ' ', 0);
seq_put_decimal_ull(m, ' ', 0);
seq_put_decimal_ll(m, ' ', task->exit_signal);
seq_put_decimal_ll(m, ' ', task_cpu(task));
seq_put_decimal_ull(m, ' ', task->rt_priority);
seq_put_decimal_ull(m, ' ', task->policy);
seq_put_decimal_ull(m, ' ', delayacct_blkio_ticks(task));
seq_put_decimal_ull(m, ' ', cputime_to_clock_t(gtime));
seq_put_decimal_ll(m, ' ', cputime_to_clock_t(cgtime));
seq_put_decimal_ull(m, " ", 0);
seq_put_decimal_ull(m, " ", 0);
seq_put_decimal_ll(m, " ", task->exit_signal);
seq_put_decimal_ll(m, " ", task_cpu(task));
seq_put_decimal_ull(m, " ", task->rt_priority);
seq_put_decimal_ull(m, " ", task->policy);
seq_put_decimal_ull(m, " ", delayacct_blkio_ticks(task));
seq_put_decimal_ull(m, " ", cputime_to_clock_t(gtime));
seq_put_decimal_ll(m, " ", cputime_to_clock_t(cgtime));

if (mm && permitted) {
seq_put_decimal_ull(m, ' ', mm->start_data);
seq_put_decimal_ull(m, ' ', mm->end_data);
seq_put_decimal_ull(m, ' ', mm->start_brk);
seq_put_decimal_ull(m, ' ', mm->arg_start);
seq_put_decimal_ull(m, ' ', mm->arg_end);
seq_put_decimal_ull(m, ' ', mm->env_start);
seq_put_decimal_ull(m, ' ', mm->env_end);
seq_put_decimal_ull(m, " ", mm->start_data);
seq_put_decimal_ull(m, " ", mm->end_data);
seq_put_decimal_ull(m, " ", mm->start_brk);
seq_put_decimal_ull(m, " ", mm->arg_start);
seq_put_decimal_ull(m, " ", mm->arg_end);
seq_put_decimal_ull(m, " ", mm->env_start);
seq_put_decimal_ull(m, " ", mm->env_end);
} else
seq_printf(m, " 0 0 0 0 0 0 0");
seq_puts(m, " 0 0 0 0 0 0 0");

if (permitted)
seq_put_decimal_ll(m, ' ', task->exit_code);
seq_put_decimal_ll(m, " ", task->exit_code);
else
seq_put_decimal_ll(m, ' ', 0);
seq_puts(m, " 0");

seq_putc(m, '\n');
if (mm)
Expand Down Expand Up @@ -618,13 +613,13 @@ int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
* seq_printf(m, "%lu %lu %lu %lu 0 %lu 0\n",
* size, resident, shared, text, data);
*/
seq_put_decimal_ull(m, 0, size);
seq_put_decimal_ull(m, ' ', resident);
seq_put_decimal_ull(m, ' ', shared);
seq_put_decimal_ull(m, ' ', text);
seq_put_decimal_ull(m, ' ', 0);
seq_put_decimal_ull(m, ' ', data);
seq_put_decimal_ull(m, ' ', 0);
seq_put_decimal_ull(m, "", size);
seq_put_decimal_ull(m, " ", resident);
seq_put_decimal_ull(m, " ", shared);
seq_put_decimal_ull(m, " ", text);
seq_put_decimal_ull(m, " ", 0);
seq_put_decimal_ull(m, " ", data);
seq_put_decimal_ull(m, " ", 0);
seq_putc(m, '\n');

return 0;
Expand Down
Loading