linux-stable/net/caif
Kirill Tkhai d217472410 net: Convert caif_net_ops
Init method just allocates memory for new cfg, and
assigns net_generic(net, caif_net_id). Despite there is
synchronize_rcu() on error path in cfcnfg_create(),
in real this function does not use global lists,
so it looks like this synchronize_rcu() is some legacy
inheritance. Exit method removes caif devices under
rtnl_lock().

There could be a problem, if someone from foreign net
pernet_operations dereference caif_net_id of this net.
It's dereferenced in get_cfcnfg() and caif_device_list().

get_cfcnfg() is used from netdevice notifiers, where
they are called under rtnl_lock(). The notifiers can't
be called from foreign nets pernet_operations. Also,
it's used from caif_disconnect_client() and from
caif_connect_client(). The both of the functions work
with caif socket, and there is the only possibility
to have a socket, when the net is dead. This may happen
only of the socket was created as kern using sk_alloc().
Grep by PF_CAIF shows we do not create kern caif sockets,
so get_cfcnfg() is safe.

caif_device_list() is used in netdevice notifiers and exit
method under rtnl lock. Also, from caif_get() used in
the netdev notifiers and in caif_flow_cb(). The last item
is skb destructor. Since there are no kernel caif sockets
nobody can send net a packet in parallel with init/exit,
so this is also safe.

So, these pernet_operations are safe to be async.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-03-05 10:48:27 -05:00
..
Kconfig Kconfig: replace "--- help ---" with "---help---" 2012-05-07 15:01:22 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
caif_dev.c net: Convert caif_net_ops 2018-03-05 10:48:27 -05:00
caif_socket.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
caif_usb.c caif_usb: use strlcpy() instead of strncpy() 2018-01-10 15:06:14 -05:00
cfcnfg.c net: caif: use strlcpy() instead of strncpy() 2018-01-09 11:52:18 -05:00
cfctrl.c caif: reduce stack size with KASAN 2018-01-19 14:02:12 -05:00
cfdbgl.c caif: Remove my bouncing email address. 2013-04-23 13:25:51 -04:00
cfdgml.c caif: Remove my bouncing email address. 2013-04-23 13:25:51 -04:00
cffrml.c caif: fix a signedness bug in cfpkt_iterate() 2015-02-20 17:35:14 -05:00
cfmuxl.c caif: replace kmalloc/memset 0 by kzalloc 2014-10-14 16:04:07 -04:00
cfpkt_skbuff.c net: caif: remove unused hardirq.h 2018-01-08 20:59:25 -05:00
cfrfml.c net: caif: fix erroneous return value 2016-02-18 14:59:35 -05:00
cfserl.c caif: Remove my bouncing email address. 2013-04-23 13:25:51 -04:00
cfsrvl.c net: Include appropriate header file in caif/cfsrvl.c 2014-02-09 17:32:49 -08:00
cfutill.c caif: Remove my bouncing email address. 2013-04-23 13:25:51 -04:00
cfveil.c caif: Remove my bouncing email address. 2013-04-23 13:25:51 -04:00
cfvidl.c caif: Remove my bouncing email address. 2013-04-23 13:25:51 -04:00
chnl_net.c net: caif: remove unused hardirq.h 2018-01-08 20:59:25 -05:00