Re: Remove easily user-triggerable BUG from generic_setlease

From: Linus Torvalds
Date: Mon Jul 23 2012 - 15:09:37 EST


On Mon, Jul 23, 2012 at 12:04 PM, J. Bruce Fields <bfields@xxxxxxxxxxxx> wrote:
>
> Right, I wasn't clear: that patch should go to mainline as well.

Does it do anything in mainline?

> (Then, do we still want Dave's patch?: in some sense that BUG() was
> correct

Hell no.

A BUG() is *never* correct unless it's a situation where not having
the bug would do something worse (ie subtly corrupt memory). And quite
frankly, if you had a BUG() there and knew about the memory
corruption, that's just a f*cking disgrace. So no, no excuse for
BUG()s like that.

NEVER EVER add BUG() as a "well, that was unexpected". That way lies
exactly the kinds of denial-of-service attacks that that BUG() caused.

The only valid source of BUG() is if you actually find internal data
structure *corruption*, and you say "ok, I cannot possibly continue,
because anything I would do would be wrong".

Seriously. People who use BUG() statements like some kind of assert()
are a menace to society. They kill machines.

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