linux/net/caif
David Woodhouse 08613e4626 caif: Fix BUG() with network namespaces
The caif code will register its own pernet_operations, and then register
a netdevice_notifier. Each time the netdevice_notifier is triggered,
it'll do some stuff... including a lookup of its own pernet stuff with
net_generic().

If the net_generic() call ever returns NULL, the caif code will BUG().
That doesn't seem *so* unreasonable, I suppose — it does seem like it
should never happen.

However, it *does* happen. When we clone a network namespace,
setup_net() runs through all the pernet_operations one at a time. It
gets to loopback before it gets to caif. And loopback_net_init()
registers a netdevice... while caif hasn't been initialised. So the caif
netdevice notifier triggers, and immediately goes BUG().

We could imagine a complex and overengineered solution to this generic
class of problems, but this patch takes the simple approach. It just
makes caif_device_notify() *not* go looking for its pernet data
structures if the device it's being notified about isn't a caif device
in the first place.

Cc: stable@kernel.org
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-10-25 19:22:23 -04:00
..
Kconfig caif: Kconfig and Makefile fixes 2010-06-29 00:06:38 -07:00
Makefile caif: prepare support for namespaces 2011-05-15 17:45:55 -04:00
caif_dev.c caif: Fix BUG() with network namespaces 2011-10-25 19:22:23 -04:00
caif_socket.c caif: Fixes freeze on Link layer removal. 2011-05-22 20:11:47 -04:00
cfcnfg.c caif: add error handling for allocation 2011-10-03 13:45:49 -04:00
cfctrl.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfdbgl.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfdgml.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cffrml.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfmuxl.c rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER 2011-08-02 04:29:23 -07:00
cfpkt_skbuff.c caif: remove unesesarry exports 2011-05-15 17:45:56 -04:00
cfrfml.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfserl.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfsrvl.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfutill.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfveil.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
cfvidl.c caif: Remove OOM messages, use kzalloc 2011-08-28 17:16:13 -04:00
chnl_net.c Remove redundant linux/version.h includes from net/ 2011-06-21 16:03:17 -07:00