Re: [PATCH] do_brk() needs mmap_sem write-locked

From: Alan Cox
Date: Thu Jan 13 2005 - 12:02:05 EST


On Mer, 2005-01-12 at 16:03, Linus Torvalds wrote:
> if that warning ever triggers, mmap_sem will now be locked, and that will
> cause problems. So I suspect it's better to do
>
> if (down_read_trylock(&mm->mmap_sem)) {
> WARN_ON(1);
> up_read(&mm->mmap_sem);

Better to leave the lock held and remember the error then drop it at the
end - anything else means the WARN_ON case is a security hole.

-
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/