Eric Dumazet
a622b40035
l2ip: fix possible use-after-free
...
Before taking a refcount on a rcu protected structure,
we need to make sure the refcount is not zero.
syzbot reported :
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 1 PID: 23533 at lib/refcount.c:156 refcount_inc_checked lib/refcount.c:156 [inline]
WARNING: CPU: 1 PID: 23533 at lib/refcount.c:156 refcount_inc_checked+0x61/0x70 lib/refcount.c:154
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 23533 Comm: syz-executor.2 Not tainted 5.1.0-rc7+ #93
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
panic+0x2cb/0x65c kernel/panic.c:214
__warn.cold+0x20/0x45 kernel/panic.c:571
report_bug+0x263/0x2b0 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:179 [inline]
fixup_bug arch/x86/kernel/traps.c:174 [inline]
do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:272
do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:291
invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973
RIP: 0010:refcount_inc_checked lib/refcount.c:156 [inline]
RIP: 0010:refcount_inc_checked+0x61/0x70 lib/refcount.c:154
Code: 1d 98 2b 2a 06 31 ff 89 de e8 db 2c 40 fe 84 db 75 dd e8 92 2b 40 fe 48 c7 c7 20 7a a1 87 c6 05 78 2b 2a 06 01 e8 7d d9 12 fe <0f> 0b eb c1 90 90 90 90 90 90 90 90 90 90 90 55 48 89 e5 41 57 41
RSP: 0018:ffff888069f0fba8 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 000000000000f353 RSI: ffffffff815afcb6 RDI: ffffed100d3e1f67
RBP: ffff888069f0fbb8 R08: ffff88809b1845c0 R09: ffffed1015d23ef1
R10: ffffed1015d23ef0 R11: ffff8880ae91f787 R12: ffff8880a8f26968
R13: 0000000000000004 R14: dffffc0000000000 R15: ffff8880a49a6440
l2tp_tunnel_inc_refcount net/l2tp/l2tp_core.h:240 [inline]
l2tp_tunnel_get+0x250/0x580 net/l2tp/l2tp_core.c:173
pppol2tp_connect+0xc00/0x1c70 net/l2tp/l2tp_ppp.c:702
__sys_connect+0x266/0x330 net/socket.c:1808
__do_sys_connect net/socket.c:1819 [inline]
__se_sys_connect net/socket.c:1816 [inline]
__x64_sys_connect+0x73/0xb0 net/socket.c:1816
Fixes: 54652eb12c1b ("l2tp: hold tunnel while looking up sessions in l2tp_netlink")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-30 11:35:48 -04:00
..
2019-01-22 09:51:19 +01:00
2019-03-13 11:50:04 +01:00
2019-04-04 17:18:34 -07:00
2019-04-30 11:09:28 -04:00
2019-04-16 21:01:45 -07:00
2019-01-23 11:18:00 -08:00
2019-03-25 09:31:19 +01:00
2019-04-12 10:25:03 -07:00
2019-03-08 21:17:07 +01:00
2019-02-23 13:34:40 -08:00
2019-04-22 21:23:55 -07:00
2019-02-17 11:01:17 -08:00
2019-01-22 11:33:46 +01:00
2019-03-25 22:28:07 +01:00
2019-04-16 21:52:22 -07:00
2019-04-01 18:15:10 -07:00
2019-01-29 21:18:54 -08:00
2018-10-04 09:40:52 -07:00
2019-03-28 16:57:19 -07:00
2019-02-22 12:55:31 -08:00
2019-03-07 11:02:08 -08:00
2019-02-26 08:27:05 -08:00
2019-04-30 09:11:10 -04:00
2019-04-30 09:11:10 -04:00
2018-11-10 16:55:11 -08:00
2019-04-01 14:59:20 -07:00
2019-03-26 08:35:36 +01:00
2019-04-30 11:35:48 -04:00
2018-12-03 14:15:26 -08:00
2019-04-12 10:25:03 -07:00
2019-04-23 13:47:05 +02:00
2018-09-28 12:46:07 +08:00
2019-03-19 16:00:22 -07:00
2019-04-23 21:15:15 -07:00
2019-04-22 10:38:50 +02:00
2019-02-27 21:45:24 -08:00
2019-04-26 11:59:58 -04:00
2019-04-11 13:59:49 -07:00
2019-04-06 15:05:07 -07:00
2019-03-28 17:15:44 -07:00
2019-03-20 10:46:50 -07:00
2019-02-21 16:23:56 -08:00
2019-03-05 21:07:14 -08:00
2019-04-24 12:07:08 -07:00
2018-12-18 13:13:56 +01:00
2019-04-24 14:39:26 -07:00
2019-04-30 10:50:50 -04:00
2019-04-04 10:55:59 -07:00
2019-04-12 10:25:03 -07:00
2019-04-11 11:04:08 -07:00
2019-04-10 13:07:02 -07:00
2019-04-23 13:40:55 -07:00
2019-03-01 21:35:19 -08:00
2019-04-16 21:32:02 -07:00
2019-04-27 20:17:19 -04:00
2019-03-08 14:48:40 -08:00
2019-03-08 15:15:44 -08:00
2019-04-23 13:45:30 +02:00
2019-03-11 15:40:14 -07:00
2019-03-16 01:27:51 +01:00
2019-03-27 16:14:05 +01:00
2019-03-05 14:08:26 -08:00
2019-02-26 08:49:05 -08:00
2019-02-28 08:24:23 -07:00
2019-03-15 15:29:47 -07:00