Cong Wang
672ecbe1c9
tipc: fix a null pointer deref on error path
...
In tipc_topsrv_kern_subscr() when s->tipc_conn_new() fails
we call tipc_close_conn() to clean up, but in this case
calling conn_put() is just enough.
This fixes the folllowing crash:
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1 ] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 3085 Comm: syzkaller064164 Not tainted 4.15.0-rc1+ #137
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
task: 00000000c24413a5 task.stack: 000000005e8160b5
RIP: 0010:__lock_acquire+0xd55/0x47f0 kernel/locking/lockdep.c:3378
RSP: 0018:ffff8801cb5474a8 EFLAGS: 00010002
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffff85ecb400
RBP: ffff8801cb547830 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: ffffffff87489d60 R12: ffff8801cd2980c0
R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000020
FS: 00000000014ee880(0000) GS:ffff8801db400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffee2426e40 CR3: 00000001cb85a000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4004
__raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
_raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:175
spin_lock_bh include/linux/spinlock.h:320 [inline]
tipc_subscrb_subscrp_delete+0x8f/0x470 net/tipc/subscr.c:201
tipc_subscrb_delete net/tipc/subscr.c:238 [inline]
tipc_subscrb_release_cb+0x17/0x30 net/tipc/subscr.c:316
tipc_close_conn+0x171/0x270 net/tipc/server.c:204
tipc_topsrv_kern_subscr+0x724/0x810 net/tipc/server.c:514
tipc_group_create+0x702/0x9c0 net/tipc/group.c:184
tipc_sk_join net/tipc/socket.c:2747 [inline]
tipc_setsockopt+0x249/0xc10 net/tipc/socket.c:2861
SYSC_setsockopt net/socket.c:1851 [inline]
SyS_setsockopt+0x189/0x360 net/socket.c:1830
entry_SYSCALL_64_fastpath+0x1f/0x96
Fixes: 14c04493cb77 ("tipc: add ability to order and receive topology events in driver")
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Cc: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-12-05 14:51:59 -05:00
..
2015-05-14 12:24:45 -04:00
2016-07-26 14:26:42 -07:00
2017-10-13 08:46:00 -07:00
2017-01-20 12:10:17 -05:00
2017-09-06 21:25:52 -07:00
2017-09-01 17:42:05 -07:00
2016-11-18 10:59:15 -05:00
2017-10-13 08:46:00 -07:00
2017-11-01 12:38:45 +09:00
2016-04-07 17:00:13 -04:00
2015-02-27 18:18:48 -05:00
2017-11-27 14:44:45 -05:00
2017-10-13 08:46:01 -07:00
2015-02-27 18:18:48 -05:00
2015-03-05 22:08:42 -05:00
2017-11-11 15:36:05 +09:00
2016-09-02 17:10:24 -07:00
2017-11-04 09:26:51 +09:00
2017-11-03 15:48:46 +09:00
2016-07-26 14:26:42 -07:00
2017-11-16 10:49:00 +09:00
2017-11-16 10:49:00 +09:00
2017-01-16 13:31:53 -05:00
2015-11-20 14:06:10 -05:00
2017-10-26 09:38:34 +09:00
2017-10-13 08:46:00 -07:00
2017-04-13 13:58:22 -04:00
2016-08-18 23:36:07 -07:00
2017-08-23 22:31:38 -07:00
2017-04-13 13:58:22 -04:00
2016-07-26 14:26:42 -07:00
2017-11-16 10:49:00 +09:00
2017-10-13 08:46:00 -07:00
2017-12-05 14:51:59 -05:00
2017-10-13 08:46:00 -07:00
2017-11-01 12:38:45 +09:00
2016-05-03 15:51:16 -04:00
2017-11-01 12:38:45 +09:00
2017-03-28 18:03:33 -07:00
2014-09-01 17:51:48 -07:00
2017-12-01 15:14:22 -05:00
2016-08-26 21:38:41 -07:00