Subject: WARNING in refcount_inc (2)

From: syzbot <[email-masked]>
Date: Tue, 19 Dec 2017 00:38:01 -0800

Hello,

syzkaller hit the following crash on  
6084b576dca2e898f5c101baef151f7bfdbb606d
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.

Unfortunately, I don't have any reproducer for this bug yet.

binder: release 623:630 transaction 328 out, still active
binder: undelivered TRANSACTION_COMPLETE
binder: send failed reply for transaction 328, target dead
------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 0 PID: 703 at lib/refcount.c:153 refcount_inc+0x47/0x50  
lib/refcount.c:153
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 703 Comm: syz-executor3 Not tainted 4.15.0-rc3-next-20171214+  
#67
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0xe9/0x14b lib/dump_stack.c:53
  panic+0x10e/0x2f8 kernel/panic.c:183
  __warn+0x14e/0x150 kernel/panic.c:547
  report_bug+0x11e/0x1a0 lib/bug.c:184
  fixup_bug.part.11+0x17/0x30 arch/x86/kernel/traps.c:177
  fixup_bug arch/x86/kernel/traps.c:246 [inline]
  do_error_trap+0x14a/0x180 arch/x86/kernel/traps.c:295
  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:314
  invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1079
RIP: 0010:refcount_inc+0x47/0x50 lib/refcount.c:153
RSP: 0018:ffffc90000dc7aa8 EFLAGS: 00010292
RAX: 000000000000002b RBX: ffff8801e08c5c38 RCX: ffffffff8123dede
RDX: 0000000000004525 RSI: ffffc90003c1b000 RDI: 0000000000000216
RBP: ffffc90000dc7ab0 R08: ffff88021fc1bda8 R09: 0000000000000000
R10: ffffc90000dc7a30 R11: 0000000000000000 R12: 000000000000006c
R13: ffff8801e08c5c38 R14: 0000000000000000 R15: ffff8801e0330100
  xfrm_state_hold include/net/xfrm.h:858 [inline]
  xfrm_state_flush+0x185/0x2b0 net/xfrm/xfrm_state.c:719
  pfkey_flush+0x6f/0xd0 net/key/af_key.c:1753
  pfkey_process+0x255/0x290 net/key/af_key.c:2809
  pfkey_sendmsg+0x193/0x310 net/key/af_key.c:3648
  sock_sendmsg_nosec net/socket.c:636 [inline]
  sock_sendmsg+0x51/0x70 net/socket.c:646
  ___sys_sendmsg+0x35e/0x3b0 net/socket.c:2026
  __sys_sendmsg+0x50/0x90 net/socket.c:2060
  SYSC_sendmsg net/socket.c:2071 [inline]
  SyS_sendmsg+0x2d/0x50 net/socket.c:2067
  entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x452a39
RSP: 002b:00007f6bbd99dc58 EFLAGS: 00000212 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: cccccccccccccccd RCX: 0000000000452a39
RDX: 0000000000000080 RSI: 000000002019d000 RDI: 0000000000000016
RBP: 00000000000005be R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006f6a70
R13: 00000000ffffffff R14: 00007f6bbd99e6d4 R15: 0000000000000000
Dumping ftrace buffer:
    (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to [email-masked].
Please credit me with: Reported-by: syzbot <[email-masked]>

syzbot will keep track of this bug report.
Once a fix for this bug is merged into any tree, reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.