alistair23-linux/drivers
Md Haris Iqbal 558d52b297 RDMA/rtrs-srv: Incorporate ib_register_client into rtrs server init
The rnbd_server module's communication manager (cm) initialization depends
on the registration of the "network namespace subsystem" of the RDMA CM
agent module. As such, when the kernel is configured to load the
rnbd_server and the RDMA cma module during initialization; and if the
rnbd_server module is initialized before RDMA cma module, a null ptr
dereference occurs during the RDMA bind operation.

Call trace:

  Call Trace:
   ? xas_load+0xd/0x80
   xa_load+0x47/0x80
   cma_ps_find+0x44/0x70
   rdma_bind_addr+0x782/0x8b0
   ? get_random_bytes+0x35/0x40
   rtrs_srv_cm_init+0x50/0x80
   rtrs_srv_open+0x102/0x180
   ? rnbd_client_init+0x6e/0x6e
   rnbd_srv_init_module+0x34/0x84
   ? rnbd_client_init+0x6e/0x6e
   do_one_initcall+0x4a/0x200
   kernel_init_freeable+0x1f1/0x26e
   ? rest_init+0xb0/0xb0
   kernel_init+0xe/0x100
   ret_from_fork+0x22/0x30
  Modules linked in:
  CR2: 0000000000000015

All this happens cause the cm init is in the call chain of the module
init, which is not a preferred practice.

So remove the call to rdma_create_id() from the module init call chain.
Instead register rtrs-srv as an ib client, which makes sure that the
rdma_create_id() is called only when an ib device is added.

Fixes: 9cb8374804 ("RDMA/rtrs: server: main functionality")
Link: https://lore.kernel.org/r/20200907103106.104530-1-haris.iqbal@cloud.ionos.com
Reported-by: kernel test robot <rong.a.chen@intel.com>
Signed-off-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Reviewed-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-09-09 13:31:08 -03:00
..
accessibility Char/Misc driver fixes for 5.9-rc3 2020-08-26 10:50:50 -07:00
acpi Merge branch 'acpi-mm' 2020-08-28 21:17:56 +02:00
amba
android drivers: android: Fix the SPDX comment style 2020-07-29 17:05:44 +02:00
ata treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
atm treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
auxdisplay treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
base Device properties framework fix for 5.9-rc3 2020-08-28 13:23:31 -07:00
bcma bcma: gpio: Use irqchip template 2020-08-02 18:26:51 +03:00
block block-5.9-2020-08-28 2020-08-28 16:38:29 -07:00
bluetooth Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2020-07-31 15:11:52 -07:00
bus treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
cdrom
char Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2020-08-30 15:53:44 -07:00
clk More ACPI updates for 5.9-rc1 2020-08-15 08:18:22 -07:00
clocksource treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
connector
counter
cpufreq Power management fixes for 5.9-rc3 2020-08-28 13:12:09 -07:00
cpuidle cpuidle: Make CPUIDLE_FLAG_TLB_FLUSHED generic 2020-08-26 12:41:53 +02:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2020-08-30 15:53:44 -07:00
dax dax: do not print error message for non-persistent memory block device 2020-08-20 11:43:18 -06:00
dca
devfreq PM / devfreq: Fix the wrong end with semicolon 2020-07-30 17:22:58 +09:00
dio
dma fsldma: fix very broken 32-bit ppc ioread64 functionality 2020-08-29 13:50:56 -07:00
dma-buf A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
edac A fix to properly clear ghes_edac driver state on driver remove so that 2020-08-30 10:47:23 -07:00
eisa
extcon
firewire treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
firmware A set of fixes for interrupt chip drivers: 2020-08-30 11:56:54 -07:00
fpga
fsi
gnss
gpio treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
gpu drm fixes for 5.9-rc3 2020-08-28 09:46:48 -07:00
greybus greybus: Use fallthrough pseudo-keyword 2020-07-29 16:58:08 +02:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2020-08-25 11:13:29 -07:00
hsi treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hv hyperv-fixes for 5.9-rc3 2020-08-26 10:44:15 -07:00
hwmon hwmon fixes for v5.9-rc3 2020-08-29 12:37:00 -07:00
hwspinlock
hwtracing treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
i2c Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2020-08-29 13:13:44 -07:00
i3c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ide treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
idle cpuidle: Make CPUIDLE_FLAG_TLB_FLUSHED generic 2020-08-26 12:41:53 +02:00
iio iio: dpot-dac: fix code comment in dpot_dac_read_raw() 2020-08-26 14:02:24 -05:00
infiniband RDMA/rtrs-srv: Incorporate ib_register_client into rtrs server init 2020-09-09 13:31:08 -03:00
input treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
interconnect Char/Misc driver patches for 5.9-rc1 2020-08-05 11:43:47 -07:00
iommu treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ipack
irqchip A set of fixes for interrupt chip drivers: 2020-08-30 11:56:54 -07:00
isdn treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
leds LEDs changes for 5.9-rc1. 2020-08-05 19:24:27 -07:00
lightnvm treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
macintosh treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
mailbox iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
mcb
md block-5.9-2020-08-28 2020-08-28 16:38:29 -07:00
media media: dib0700: Fix identation issue in dib8096_set_param_override() 2020-08-27 15:36:28 -05:00
memory treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
memstick treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
message treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
mfd - Bug Fixes 2020-08-28 10:15:33 -07:00
misc Char/Misc driver fixes for 5.9-rc3 2020-08-26 10:50:50 -07:00
mmc treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
most drivers: most: add USB adapter driver 2020-07-31 14:38:12 +02:00
mtd This pull request contains changes for JFFS2, UBI and UBIFS 2020-08-10 18:20:04 -07:00
mux treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
net RDMA/qedr: Fix reported max_pkeys 2020-09-02 15:42:36 -03:00
nfc treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ntb treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
nubus
nvdimm libnvdimm: KASAN: global-out-of-bounds Read in internal_create_group 2020-08-17 14:47:38 -06:00
nvme io_uring-5.9-2020-08-23 2020-08-24 11:53:15 -07:00
nvmem nvmem: qcom-spmi-sdam: Enable multiple devices 2020-07-29 17:12:09 +02:00
of of: address: Work around missing device_type property in pcie nodes 2020-08-19 16:30:57 -06:00
opp opp: Enable resources again if they were disabled earlier 2020-08-20 11:30:22 +05:30
oprofile
parisc Merge branch 'parisc-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2020-08-12 12:41:15 -07:00
parport treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pci treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pcmcia treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
perf treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
phy treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pinctrl This is the bulk of the pin control changes for the v5.9 2020-08-09 12:52:28 -07:00
platform treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pnp
power treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
powercap This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
pps
ps3 treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ptp ptp: ptp_clockmatrix: use i2c_master_send for i2c write 2020-08-19 16:23:22 -07:00
pwm pwm: Changes for v5.9-rc1 2020-08-14 16:00:09 -07:00
rapidio treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ras
regulator treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
remoteproc treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
reset treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
rpmsg treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
rtc treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
s390 treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sbus
scsi treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sfi
sh iomap: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
siox
slimbus
soc treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
soundwire
spi treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
spmi
ssb treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
staging treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
target treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
tc
tee
thermal treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
thunderbolt treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
tty TTY/Serial fixes for 5.9-rc3 2020-08-26 10:58:20 -07:00
uio
usb USB fixes for 5.9-rc3 - take 2 2020-08-30 10:51:03 -07:00
vdpa vdpa/mlx5: Avoid warnings about shifts on 32-bit platforms 2020-08-26 08:13:59 -04:00
vfio treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
vhost vhost-iotlb: fix vhost_iotlb_itree_next() documentation 2020-08-26 08:13:59 -04:00
video powerpc fixes for 5.9 #4 2020-08-30 10:56:12 -07:00
virt
virtio virtio: pci: constify ioreadX() iomem argument (as in generic implementation) 2020-08-14 19:56:57 -07:00
visorbus
vlynq
vme
w1
watchdog treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
xen xen: branch for v5.9-rc3 2020-08-29 12:44:30 -07:00
zorro
Kconfig
Makefile