lkml.org 
[lkml]   [2008]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix check after use in kernel/exit.c

* WANG Cong <xiyou.wangcong@gmail.com> wrote:

> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -583,8 +583,6 @@ static void exit_mm(struct task_struct * tsk)
> struct mm_struct *mm = tsk->mm;
>
> mm_release(tsk, mm);
> - if (!mm)
> - return;

> @@ -464,6 +464,8 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
> {
> struct completion *vfork_done = tsk->vfork_done;
>
> + if (!mm)
> + return;
> /* Get rid of any cached register state */
> deactivate_mm(tsk, mm);

no, this is buggy in the same way - we wont do a deactivate_mm() for
kernel threads. The check should be left alone in exit_mm(), we should
at most add a check for NULL mm to this place:

if (tsk->clear_child_tid
&& !(tsk->flags & PF_SIGNALED)
&& atomic_read(&mm->mm_users) > 1) {

but ... can mm in fact ever be NULL if tsk->clear_child_tid is set?

Ingo


\
 
 \ /
  Last update: 2008-03-10 10:17    [W:0.039 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site