linux-stable/net/rds
Sowmini Varadhan 16c09b1c76 rds: tcp: Reorder initialization sequence in rds_tcp_init to avoid races
Order of initialization in rds_tcp_init needs to be done so
that resources are set up and destroyed in the correct synchronization
sequence with both the data path, as well as netns create/destroy
path. Specifically,

- we must call register_pernet_subsys and get the rds_tcp_netid
  before calling register_netdevice_notifier, otherwise we risk
  the sequence
    1. register_netdevice_notifier sets up netdev notifier callback
    2. rds_tcp_dev_event -> rds_tcp_kill_sock uses netid 0, and finds
       the wrong rtn, resulting in a panic with string that is of the form:

  BUG: unable to handle kernel NULL pointer dereference at 000000000000000d
  IP: rds_tcp_kill_sock+0x3a/0x1d0 [rds_tcp]
         :

- the rds_tcp_incoming_slab kmem_cache must be initialized before the
  datapath starts up. The latter can happen any time after the
  pernet_subsys registration of rds_tcp_net_ops, whose -> init
  function sets up the listen socket. If the rds_tcp_incoming_slab has
  not been set up at that time, a panic of the form below may be
  encountered

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000014
  IP: kmem_cache_alloc+0x90/0x1c0
     :
  rds_tcp_data_recv+0x1e7/0x370 [rds_tcp]
  tcp_read_sock+0x96/0x1c0
  rds_tcp_recv_path+0x65/0x80 [rds_tcp]
     :

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-03-07 14:09:59 -08:00
..
af_rds.c RDS: validate the requested traces user input against max supported 2017-01-06 22:14:26 -05:00
bind.c RDS: log the address on bind failure 2017-01-02 14:02:39 -08:00
cong.c RDS: split out connection specific state from rds_connection to rds_conn_path 2016-06-14 23:50:41 -07:00
connection.c rds: tcp: Take explicit refcounts on struct net 2017-03-07 14:09:59 -08:00
ib.c rds: remove unnecessary returned value check 2017-03-03 09:51:22 -08:00
ib.h This is a tree wide change and has been kept separate for that reason. 2017-02-25 13:45:43 -08:00
ib_cm.c RDS: IB: fix panic due to handlers running post teardown 2017-01-02 14:02:55 -08:00
ib_fmr.c RDS: IB: move FMR code to its own file 2016-03-02 14:13:18 -05:00
ib_frmr.c RDS: IB: split the mr registration and invalidation path 2017-01-02 14:02:47 -08:00
ib_mr.h rds: ib: add the static type to the variables 2017-03-01 09:50:58 -08:00
ib_rdma.c RDS: split out connection specific state from rds_connection to rds_conn_path 2016-06-14 23:50:41 -07:00
ib_recv.c RDS: add receive message trace used by application 2017-01-02 14:02:59 -08:00
ib_ring.c
ib_send.c rds:Remove unnecessary ib_ring unalloc 2017-02-17 15:19:51 -05:00
ib_stats.c RDS: IB: add few useful cache stasts 2017-01-02 14:02:51 -08:00
ib_sysctl.c net: Convert uses of typedef ctl_table to struct ctl_table 2013-06-13 02:36:09 -07:00
info.c rds: fix an integer overflow test in rds_info_getsockopt() 2015-08-03 15:20:16 -07:00
info.h
Kconfig RDS: Drop stale iWARP RDMA transport 2016-03-02 14:13:17 -05:00
loop.c RDS: TCP: Hooks to set up a single connection path 2016-07-01 16:45:17 -04:00
loop.h
Makefile rds: debug messages are enabled by default 2016-10-29 15:55:57 -04:00
message.c RDS: TCP: Track peer's connection generation number 2016-11-17 13:35:18 -05:00
page.c rds: remove dead code 2016-12-26 21:35:39 -05:00
rdma.c RDS: make message size limit compliant with spec 2017-01-02 14:02:57 -08:00
rdma_transport.c RDS: RDMA: start rdma listening after init 2017-01-02 14:02:45 -08:00
rdma_transport.h RDS: Drop stale iWARP RDMA transport 2016-03-02 14:13:17 -05:00
rds.h rds: tcp: Take explicit refcounts on struct net 2017-03-07 14:09:59 -08:00
rds_single_path.h RDS: split out connection specific state from rds_connection to rds_conn_path 2016-06-14 23:50:41 -07:00
recv.c RDS: add receive message trace used by application 2017-01-02 14:02:59 -08:00
send.c RDS: make message size limit compliant with spec 2017-01-02 14:02:57 -08:00
stats.c net/rds: zero last byte for strncpy 2013-03-08 00:35:44 -05:00
sysctl.c net: rds: fix coding style issues 2016-06-18 21:34:09 -07:00
tcp.c rds: tcp: Reorder initialization sequence in rds_tcp_init to avoid races 2017-03-07 14:09:59 -08:00
tcp.h RDS: TCP: avoid bad page reference in rds_tcp_listen_data_ready 2016-07-15 11:36:57 -07:00
tcp_connect.c RDS: TCP: Force every connection to be initiated by numerically smaller IP address 2016-11-17 13:35:18 -05:00
tcp_listen.c RDS: mark few internal functions static to make sparse build happy 2017-01-02 14:02:40 -08:00
tcp_recv.c RDS: add receive message trace used by application 2017-01-02 14:02:59 -08:00
tcp_send.c RDS: TCP: set RDS_FLAG_RETRANSMITTED in cp_retrans list 2016-11-17 13:35:18 -05:00
tcp_stats.c net: rds: fix const array syntax 2011-07-01 16:16:19 -07:00
threads.c rds: Remove duplicate prefix from rds_conn_path_error use 2016-10-17 11:07:22 -04:00
transport.c rds: remove unnecessary returned value check 2017-03-03 09:51:22 -08:00