IB/core: Init subsys if compiled to vmlinuz-core
authorDmitry Monakhov <dmonakhov@openvz.org>
Mon, 27 Nov 2017 13:39:05 +0000 (13:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:07:57 +0000 (11:07 +0100)
commit2ded534c9074c8e8df4636e617f778618c695593
tree8cc07843a193e46e415e46f299aa47e060560423
parent1ffc1b361ac23ee73efd87f5fc812d5e39e06b2e
IB/core: Init subsys if compiled to vmlinuz-core

[ Upstream commit a9cd1a673737dd81332fce1145801bfacfb90d90 ]

Once infiniband is compiled as a core component its subsystem must be
enabled before device initialization. Otherwise there is a NULL pointer
dereference during mlx4_core init, calltrace:
->device_add
  if (dev->class) {
     deref  dev->class->p =>NULLPTR

#Config
CONFIG_NET_DEVLINK=y
CONFIG_MAY_USE_DEVLINK=y
CONFIG_MLX4_EN=y

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/device.c