diff --git a/drivers/staging/hungtask/hungtask_user.c b/drivers/staging/hungtask/hungtask_user.c index 39b0b1bd50351415d8c2d831c1477cab65b81032..4d4627132a37780a773fe416f160f853e4c61cad 100644 --- a/drivers/staging/hungtask/hungtask_user.c +++ b/drivers/staging/hungtask/hungtask_user.c @@ -38,13 +38,18 @@ static void htuser_show_task(int pid) { struct task_struct *p = NULL; + rcu_read_lock(); p = pid_task(find_vpid(pid), PIDTYPE_PID); - if (p == NULL) { + if(p) + get_task_struct(p); + rcu_read_unlock(); + if (!p) { pr_err("can not find pid %d\n", pid); return; } if (p->flags & PF_FROZEN) { + put_task_struct(p); pr_info("process %d is frozen\n", pid); return; } @@ -53,6 +58,7 @@ static void htuser_show_task(int pid) sched_show_task(p); pr_err("UserList_KernelStack end\n"); } + put_task_struct(p); } static void htuser_list_insert(int pid, int count) @@ -242,7 +248,7 @@ ssize_t htuser_list_store(struct kobject *kobj, len = p ? (size_t)(p - buf) : count; strncpy(tmp, buf, len); - if (strncmp(tmp, "on", CMD_MIN_LEN) == 0) { + if (strncmp(tmp, "on,", CMD_MIN_LEN) == 0) { if (htuser_list_store_on(tmp, len, pid)) return -EINVAL; } else if (unlikely(strncmp(tmp, "off", CMD_MIN_LEN) == 0)) {