Re: Possible mem leak in copy_process()

From: Ingo Molnar
Date: Thu Apr 17 2008 - 09:03:30 EST



* Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> > 1331 if (likely(p->pid)) {

> > 1351 }

> > Event leaked_storage: Returned without freeing storage "pid" Also
> > see events: [alloc_fn][var_assign][pass_arg]
>
> this looks like a false alarm.
>
> p->pid == pid->numbers[0].nr. If "struct pid *pid" was allocated, its
> .nr can't be 0.
>
> IOW, !p->pid means that pid == init_struct_pid, it wasn't allocated
> but was passed from the caller.

should we perhaps codify this rule via adding something like this to the
else branch:

WARN_ON_ONCE(task_pid(p) != &init_struct_pid);

?

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/