From: Dotan Barak Date: Thu, 21 Jun 2012 21:14:54 +0000 (+0300) Subject: rds: fixed kernel oops in case of error flow X-Git-Tag: v4.1.12-92~319^2^2~2^2~21 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5a73459e71465a88e326e388d05125c15e88b64e;p=users%2Fjedix%2Flinux-maple.git 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: [] _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:[] [] _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: [] cma_exch+0x35/0x70 [rdma_cm] [] rdma_destroy_id+0x21/0x310 [rdma_cm] [] init_module+0xbe/0x118 [rds_rdma] [] ? __blocking_notifier_call_chain+0x65/0x80 [] ? init_module+0x0/0x118 [rds_rdma] [] do_one_initcall+0x3c/0x1d0 [] sys_init_module+0xe1/0x250 [] 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 0f c1 07 0f b7 c8 c1 e8 10 39 c1 74 0e f3 90 0f 1f 44 00 00 RIP [] _spin_lock_irqsave+0x1f/0x40 RSP CR2: 00000000000001fc ---[ end trace 8db2f942777f29d0 ]--- Signed-off-by: Dotan Barak --- diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c index b8a1b16289f09..c79bb56a85844 100644 --- a/net/rds/rdma_transport.c +++ b/net/rds/rdma_transport.c @@ -153,7 +153,7 @@ static int rds_rdma_listen_init(void) ret = PTR_ERR(cm_id); printk(KERN_ERR "RDS/RDMA: failed to setup listener, " "rdma_create_id() returned %d\n", ret); - goto out; + return ret; } sin.sin_family = PF_INET,