Messages in this thread Patch in this message | | | Date | Thu, 6 Jul 2000 16:18:10 +0200 | Subject | 2.2.x: bugs in tasklist_lock usage? (and silly errata update) | From | <> |
| |
Hi all, in my last e-mail I introduced a very silly error (not related with the described error) the right patch is attached
--- array.c Wed Jun 7 23:26:44 2000 +++ array.c.modified Thu Jul 6 16:14:16 2000 @@ -483,14 +483,25 @@ static int get_env(int pid, char * buffer) { struct task_struct *p; - + int retval; + read_lock(&tasklist_lock); p = find_task_by_pid(pid); - read_unlock(&tasklist_lock); /* FIXME!! This should be done after the last use */ - if (!p || !p->mm) + /* If unlock the tasklist_lock before use this, the task could exit + * on other processor and then the references be bogus, this also + * happens on other functions that use the tasklist_lock + */ + if (!p || !p->mm) { + read_unlock(&tasklist_lock); return 0; - return get_array(p, p->mm->env_start, p->mm->env_end, buffer); + } + + /* Seems get_array() can't sleep */ + retval= get_array(p, p->mm->env_start, p->mm->env_end, buffer); + read_unlock(&tasklist_lock); + + return retval; } static int get_arg(int pid, char * buffer) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |