rds: fixed kernel oops in case of error flow
If failed to create an rdma_cm handler, don't try to free it and
prevent the following kernel oops:
BUG: unable to handle kernel NULL pointer dereference at
00000000000001fc
IP: [<
ffffffff814ef21f>] _spin_lock_irqsave+0x1f/0x40
PGD
175b80067 PUD
176a0b067 PMD 0
Oops: 0002 [#1] SMP
last sysfs file: /sys/module/rds/initstate
CPU 0
Modules linked in: rds_rdma(+)(U) rds(U) ib_ucm(U) rdma_cm(U) iw_cm(U) ib_addr(U) ib_srp(U) scsi_transport_srp scsi_tgt ib_ipoib(U) ib_cm(U) ib_sa(U) ib_uverbs(U) ib_umad(U) mlx4_ib(U) ib_mad(U) ib_core(U) mlx4_core(U) memtrack(U) netconsole configfs nfs fscache nfsd lockd nfs_acl auth_rpcgss exportfs autofs4 sunrpc ipv6 microcode virtio_balloon virtio_net snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc i2c_piix4 i2c_core ext3 jbd mbcache virtio_blk pata_acpi ata_generic ata_piix virtio_pci virtio_ring virtio dm_mirror dm_region_hash dm_log dm_mod [last unloaded: memtrack]
Pid: 22908, comm: modprobe Not tainted 2.6.32-220.el6.x86_64 #1 Red Hat KVM
RIP: 0010:[<
ffffffff814ef21f>] [<
ffffffff814ef21f>] _spin_lock_irqsave+0x1f/0x40
RSP: 0018:
ffff880125f07e68 EFLAGS:
00010086
RAX:
0000000000010000 RBX:
fffffffffffffff4 RCX:
0000000000000000
RDX:
0000000000000286 RSI:
000000000000000a RDI:
00000000000001fc
RBP:
ffff880125f07e68 R08:
0000000000000000 R09:
ffff880176db4020
R10:
ffff880125f07988 R11:
0000000000000002 R12:
00000000000001fc
R13:
0000000000d8e4c0 R14:
000000000000000a R15:
0000000000000000
FS:
00007f66c90cc700(0000) GS:
ffff880028200000(0000) knlGS:
0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0:
000000008005003b
CR2:
00000000000001fc CR3:
000000011e71b000 CR4:
00000000000006f0
DR0:
0000000000000000 DR1:
0000000000000000 DR2:
0000000000000000
DR3:
0000000000000000 DR6:
00000000ffff0ff0 DR7:
0000000000000400
Process modprobe (pid: 22908, threadinfo
ffff880125f06000, task
ffff880174732b40)
Stack:
ffff880125f07e98 ffffffffa03dd795 fffffffffffffff4 fffffffffffffff4
<0>
0000000000d8e4c0 0000000000000000 ffff880125f07ed8 ffffffffa03dee11
<0>
ffff880125f07ee8 00000000fffffff4 00000000fffffff4 fffffffffffffff4
Call Trace:
[<
ffffffffa03dd795>] cma_exch+0x35/0x70 [rdma_cm]
[<
ffffffffa03dee11>] rdma_destroy_id+0x21/0x310 [rdma_cm]
[<
ffffffffa042a0be>] init_module+0xbe/0x118 [rds_rdma]
[<
ffffffff81096e75>] ? __blocking_notifier_call_chain+0x65/0x80
[<
ffffffffa042a000>] ? init_module+0x0/0x118 [rds_rdma]
[<
ffffffff8100204c>] do_one_initcall+0x3c/0x1d0
[<
ffffffff810af641>] sys_init_module+0xe1/0x250
[<
ffffffff8100b0f2>] system_call_fastpath+0x16/0x1b
Code: c9 c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00 9c 58 0f 1f 44 00 00 48 89 c2 fa 66 0f 1f 44 00 00 b8 00 00 01 00 <f0> 0f c1 07 0f b7 c8 c1 e8 10 39 c1 74 0e f3 90 0f 1f 44 00 00
RIP [<
ffffffff814ef21f>] _spin_lock_irqsave+0x1f/0x40
RSP <
ffff880125f07e68>
CR2:
00000000000001fc
---[ end trace
8db2f942777f29d0 ]---
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>