Leon Romanovsky
340b940ea0
RDMA/cm: Fix an attempt to use non-valid pointer when cleaning timewait
If cm_create_timewait_info() fails, the timewait_info pointer will contain
an error value and will be used in cm_remove_remote() later.
general protection fault, probably for non-canonical address 0xdffffc0000000024: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range [0×0000000000000120-0×0000000000000127]
CPU: 2 PID: 12446 Comm: syz-executor.3 Not tainted 5.10.0-rc5-5d4c0742a60e #27
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
RIP: 0010:cm_remove_remote.isra.0+0x24/0×170 drivers/infiniband/core/cm.c:978
Code: 84 00 00 00 00 00 41 54 55 53 48 89 fb 48 8d ab 2d 01 00 00 e8 7d bf 4b fe 48 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <0f> b6 04 02 48 89 ea 83 e2 07 38 d0 7f 08 84 c0 0f 85 fc 00 00 00
RSP: 0018:ffff888013127918 EFLAGS: 00010006
RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: ffffc9000a18b000
RDX: 0000000000000024 RSI: ffffffff82edc573 RDI: fffffffffffffff4
RBP: 0000000000000121 R08: 0000000000000001 R09: ffffed1002624f1d
R10: 0000000000000003 R11: ffffed1002624f1c R12: ffff888107760c70
R13: ffff888107760c40 R14: fffffffffffffff4 R15: ffff888107760c9c
FS: 00007fe1ffcc1700(0000) GS:ffff88811a600000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2ff21000 CR3: 000000010f504001 CR4: 0000000000370ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
cm_destroy_id+0x189/0×15b0 drivers/infiniband/core/cm.c:1155
cma_connect_ib drivers/infiniband/core/cma.c:4029 [inline]
rdma_connect_locked+0x1100/0×17c0 drivers/infiniband/core/cma.c:4107
rdma_connect+0x2a/0×40 drivers/infiniband/core/cma.c:4140
ucma_connect+0x277/0×340 drivers/infiniband/core/ucma.c:1069
ucma_write+0x236/0×2f0 drivers/infiniband/core/ucma.c:1724
vfs_write+0x220/0×830 fs/read_write.c:603
ksys_write+0x1df/0×240 fs/read_write.c:658
do_syscall_64+0x33/0×40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: a977049dac ("[PATCH] IB: Add the kernel CM implementation")
Link: https://lore.kernel.org/r/20201204064205.145795-1-leon@kernel.org
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Reported-by: Amit Matityahu <mitm@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2020-12-09 15:51:35 -04:00
..
2020-09-30 15:29:05 -03:00
2020-12-07 16:32:04 -04:00
2020-01-25 15:11:37 -04:00
2020-08-24 19:41:41 -03:00
2020-08-24 19:41:41 -03:00
2020-12-09 15:51:35 -04:00
2020-10-01 21:20:11 -03:00
2020-05-27 16:05:05 -03:00
2020-01-07 16:10:53 -04:00
2020-08-24 16:01:47 -03:00
2020-10-28 09:14:49 -03:00
2020-09-22 19:47:35 -03:00
2020-09-22 19:47:35 -03:00
2020-09-22 19:47:35 -03:00
2020-10-16 13:53:46 -03:00
2020-01-25 14:48:33 -04:00
2020-03-04 14:28:25 -04:00
2019-10-22 14:45:31 -03:00
2020-05-06 16:51:43 -03:00
2020-06-24 16:43:45 -03:00
2020-06-24 16:43:45 -03:00
2020-08-06 16:43:36 -07:00
2020-08-24 19:41:41 -03:00
2020-05-06 11:57:33 -03:00
2019-10-24 20:49:37 -03:00
2020-07-29 15:51:19 -03:00
2020-09-30 15:27:19 -03:00
2020-05-21 20:39:36 -03:00
2020-09-22 19:47:35 -03:00
2020-09-22 19:47:35 -03:00
2020-09-28 15:00:15 -07:00
2020-08-23 17:36:59 -05:00
2020-07-02 16:05:12 -03:00
2020-03-24 19:53:25 -03:00
2020-10-01 21:20:11 -03:00
2020-07-06 14:54:46 -03:00
2020-10-16 14:07:08 -03:00
2020-05-27 13:46:05 -03:00
2020-10-01 16:44:05 -03:00
2020-10-16 12:40:58 -03:00
2020-05-06 11:57:33 -03:00
2020-09-29 13:11:06 -03:00
2020-08-23 17:36:59 -05:00
2020-10-17 11:18:18 -07:00
2020-05-12 17:02:25 -03:00
2020-09-09 14:14:29 -03:00
2020-09-22 19:47:35 -03:00
2020-10-26 19:29:26 -03:00
2020-07-24 16:44:06 -03:00
2020-05-21 20:39:36 -03:00
2020-05-21 20:39:35 -03:00
2020-09-09 14:14:29 -03:00
2020-09-17 14:04:33 -03:00
2020-05-21 20:39:36 -03:00
2020-05-21 20:34:53 -03:00
2020-10-01 21:20:11 -03:00