]> git.baikalelectronics.ru Git - kernel.git/commit
netns: Fail conspicously if someone uses net_generic at an inappropriate time.
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 26 Jan 2012 14:02:55 +0000 (14:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 28 Jan 2012 02:06:02 +0000 (21:06 -0500)
commita40fd52342af5264d7c7ab9b3eed1a19c1434968
tree0be8ae9b59828b3fee0fdf5cac9432604a317230
parentaadb57aae90cefe02bdec9ab825668c39cfe0616
netns: Fail conspicously if someone uses net_generic at an inappropriate time.

By definition net_generic should never be called when it can return
NULL.  Fail conspicously with a BUG_ON to make it clear when people mess
up that a NULL return should never happen.

Recently there was a bug in the CAIF subsystem where it was registered
with register_pernet_device instead of register_pernet_subsys.  It was
erroneously concluded that net_generic could validly return NULL and
that net_assign_generic was buggy (when it was just inefficient).
Hopefully this BUG_ON will prevent people to coming to similar erroneous
conclusions in the futrue.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Tested-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netns/generic.h