either bug or unnecessary code in exit_mm()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




In the last few kernels (at least as far back as 2.6.10), exit_mm() looks like this:


static void exit_mm(struct task_struct * tsk)
{
	struct mm_struct *mm = tsk->mm;

	mm_release(tsk, mm);
	if (!mm)
		return;




while mm_release() looks like this:




void mm_release(struct task_struct *tsk, struct mm_struct *mm)
{
	<snip>
	if (tsk->clear_child_tid && atomic_read(&mm->mm_users) > 1) {





If it's valid to call exit_mm() with tsk->mm being NULL, then it seems like we'll get problems when we dereference it unconditionally in mm_release().

If mm_release() is valid, then the check for !mm in exit_mm() is unnecessary but there should probably be a comment.

Can someone tell me which one it is?

Thanks,

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux