WARNING: refcount bug in p9_req_put

Status: fixed on 2020/11/16 12:12
Subsystems: v9fs
[Documentation on labels]
Reported-by: syzbot+edec7868af5997928fe9@syzkaller.appspotmail.com
Fix commit: a39c46067c84 net/9p: validate fds in p9_fd_open
First crash: 2941d, last: 2386d
Cause bisection: the cause commit could be any of (bisect log):
commit cbce4f44479856cd4621e3dce531cfb078357b1f
Author: Tal Gilboa <talgi@mellanox.com>
Date: Tue Apr 24 10:36:03 2018 +0000

  net/mlx5e: Enable adaptive-TX moderation

commit 623ad755226c2b4fb312772bae9cdeccd8219ee3
Author: Tal Gilboa <talgi@mellanox.com>
Date: Tue Apr 24 10:36:02 2018 +0000

  net/dim: Support adaptive TX moderation

commit 8399743a5a6796c8d5858ae3c5afc814201112d4
Author: David S. Miller <davem@davemloft.net>
Date: Tue Apr 24 14:15:08 2018 +0000

  Merge branch 'net-DIM-tx'

commit 026a807c2de37aa826748c2ffa1969fc778406b2
Author: Tal Gilboa <talgi@mellanox.com>
Date: Tue Apr 24 10:36:01 2018 +0000

  net/dim: Rename *_get_profile() functions to *_get_rx_moderation()

commit a06ac0d67d9fda7c255476c6391032319030045d
Author: Yafang Shao <laoar.shao@gmail.com>
Date: Tue Apr 24 15:07:45 2018 +0000

  Revert "net: init sk_cookie for inet socket"

commit 8c2320e84c193d4d42b8446986afa2797fb411e1
Author: Eric Dumazet <edumazet@google.com>
Date: Mon Apr 23 21:46:25 2018 +0000

  tcp: md5: only call tp->af_specific->md5_lookup() for md5 sockets

commit db688c24eada63b1efe6d0d7d835e5c3bdd71fd3
Author: Paolo Abeni <pabeni@redhat.com>
Date: Tue Apr 24 08:34:36 2018 +0000

  vhost_net: use packet weight for rx handler, too

commit 0c6f69a5e3641bccfe21fd0eeafad45a8c6db987
Author: NeilBrown <neilb@suse.com>
Date: Mon Apr 23 22:29:13 2018 +0000

  rhashtable: remove outdated comments about grow_decision etc

commit 9c20b9372fbaf6f7d4c05f5f925806a7928f0c73
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Tue Apr 24 03:08:41 2018 +0000

  net: fib_rules: fix l3mdev netlink attr processing

commit 82266e98dd4d8e7d5b8e4a0fedeb91f2eb29d306
Author: NeilBrown <neilb@suse.com>
Date: Mon Apr 23 22:29:13 2018 +0000

  rhashtable: Revise incorrect comment on r{hl, hash}table_walk_enter()

commit b300fcf883aca9b96f9281cd05df4899fae10917
Author: Anders Roxell <anders.roxell@linaro.org>
Date: Mon Apr 23 14:00:50 2018 +0000

  selftests: net: update .gitignore with missing test

commit 064223c1231ce508efaded6576ffdb07de9307b5
Author: Colin Ian King <colin.king@canonical.com>
Date: Mon Apr 23 12:49:38 2018 +0000

  dca: make function dca_common_get_tag static

commit b41cc04b662ac96bbb291fb66b7b8aab5bc0a8c9
Author: NeilBrown <neilb@suse.com>
Date: Mon Apr 23 22:29:13 2018 +0000

  rhashtable: reset iter when rhashtable_walk_start sees new table

commit 5d240a8936f6a1d3ece06701e8c4d830a2eca8a8
Author: NeilBrown <neilb@suse.com>
Date: Mon Apr 23 22:29:13 2018 +0000

  rhashtable: improve rhashtable_walk stability when stop/start used.

commit f7c3b12cec09ad487d343fc940f606d17157d047
Author: David S. Miller <davem@davemloft.net>
Date: Mon Apr 23 20:12:55 2018 +0000

  Merge branch 'ipv6-couple-of-fixes-for-rcu-change-to-from'

commit 5cb5ce336338e4087aa8d619fdb1744ad5f9998e
Author: David S. Miller <davem@davemloft.net>
Date: Tue Apr 24 17:21:46 2018 +0000

  Merge branch 'rhash-cleanups'

commit 8a14e46f140230ca889c2b0a4753ae8ea45fd770
Author: David Ahern <dsahern@gmail.com>
Date: Mon Apr 23 18:32:07 2018 +0000

  net/ipv6: Fix missing rcu dereferences on from

commit 660de409e25ba5bf34e8fdf2e13b69f1a7bd7213
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:32 2018 +0000

  ipconfig: Document setting of NIS domain name

commit c3c14da0288de79ccef2c2380cf5737077fa64ed
Author: David Ahern <dsahern@gmail.com>
Date: Mon Apr 23 18:32:06 2018 +0000

  net/ipv6: add rcu locking to ip6_negative_advice

commit 40cde8249a8280e4e24b42a4e20813ac4c1368e9
Author: David S. Miller <davem@davemloft.net>
Date: Mon Apr 23 16:05:58 2018 +0000

  Merge branch 'qed-debug-data'

commit e18bdc83aec4b7e187d9c54dc442a6ab3efac26d
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:33 2018 +0000

  ipconfig: Tidy up reporting of name servers

commit 1ac4329a1cff2e0bb12b71c13ad53a0e05bc87a6
Author: Denis Bolotin <denis.bolotin@cavium.com>
Date: Mon Apr 23 11:56:05 2018 +0000

  qed: Add configuration information to register dump and debug data

commit 4e1a8af28d56a4194cf3f17c69d9d21183246f3a
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:34 2018 +0000

  ipconfig: BOOTP: Don't request IEN-116 name servers

commit b60bfdfec5b8ec88552e75c8bd99f1ebfa66a6e0
Author: Denis Bolotin <denis.bolotin@cavium.com>
Date: Mon Apr 23 11:56:04 2018 +0000

  qed: Delete unused parameter p_ptt from mcp APIs

commit de1fa15b6642f0b66f1844b9b464a8c28e84347c
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:35 2018 +0000

  ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX name servers

commit 5f0456b43140af9413397cc11d03d18b9f2fc2fc
Author: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Mon Apr 23 08:05:15 2018 +0000

  net: stmmac: Implement logic to automatically select HW Interface

commit 8b0b37c5644e1c0e0feac5bbf673337cefa3efb2
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:36 2018 +0000

  ipconfig: Document /proc/net/pnp

commit 22148df0d0bdbd5d1cca4e069e17bf49b070498f
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun Apr 22 15:15:15 2018 +0000

  r8169: don't use netif_info et al before net_device has been registered

commit 300eec7c0a2495f771709c7642aa15f7cc148b83
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:37 2018 +0000

  ipconfig: Correctly initialise ic_nameservers

commit 4d019b3f80dc147fd9d177e7e0337fc66e3c0032
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:38 2018 +0000

  ipconfig: Create /proc/net/ipconfig directory

commit c6849a3ac17e336811f1d5bba991d2a9bdc47af1
Author: Yafang Shao <laoar.shao@gmail.com>
Date: Sun Apr 22 13:50:04 2018 +0000

  net: init sk_cookie for inet socket

commit c04d2cb2009f87cba7431c4ed3d85a602f71658e
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Apr 24 02:56:39 2018 +0000

  ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers

commit ec8c360a6ecdea595aff957c6a720e059275f1f4
Author: David S. Miller <davem@davemloft.net>
Date: Mon Apr 23 14:21:25 2018 +0000

  Merge branch 'fib-rules-extack-support'

commit b16fb418b1bf2a9f14d5d2a4fe29bde1f5550b37
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Sat Apr 21 16:41:31 2018 +0000

  net: fib_rules: add extack support

commit bc0fbc66ad1ba256718dfb220affeb4b868d8803
Author: David S. Miller <davem@davemloft.net>
Date: Tue Apr 24 17:40:42 2018 +0000

  Merge branch 'ipconfig-NTP-server-support-bug-fixes-documentation-improvements'

commit c7d852e301d834949e570920db808201bdc51a22
Author: Denis Bolotin <denis.bolotin@cavium.com>
Date: Tue Apr 24 12:32:53 2018 +0000

  qed: Fix copying 2 strings

commit f9d4b0c1e9695e3de7af3768205bacc27312320c
Author: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Sat Apr 21 16:41:30 2018 +0000

  fib_rules: move common handling of newrule delrule msgs into fib_nl2rule

commit 080aaddae5b378ebb0f06d297bf05cf4ec5b47ac
Author: Colin Ian King <colin.king@canonical.com>
Date: Tue Apr 24 11:39:45 2018 +0000

  fsl/fman_port: remove redundant check on port->rev_info.major

commit a56e6bcd34b55182159d16fcf6d6105578dfa192
Author: Roman Mashak <mrv@mojatatu.com>
Date: Sat Apr 21 03:56:51 2018 +0000

  tc-testing: updated ife test cases

commit 6163849d289be6ff2acd2fb520da303dec3219f0
Author: Yafang Shao <laoar.shao@gmail.com>
Date: Fri Apr 20 15:18:26 2018 +0000

  net: introduce a new tracepoint for tcp_rcv_space_adjust

commit 95ad7544ad3f6cf585e5b8587e7d520fa3a43ad5
Author: Colin Ian King <colin.king@canonical.com>
Date: Tue Apr 24 12:36:58 2018 +0000

  net/tls: remove redundant second null check on sgout

commit 091311debcf02ff80a76d70b524eba4b2ffe66f1
Author: Eric Dumazet <edumazet@google.com>
Date: Tue Apr 24 16:22:49 2018 +0000

  net/ipv6: fix LOCKDEP issue in rt6_remove_exception_rt()

commit 48d7a07ba355c7056e66adcdd35379d12e48252b
Author: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri Apr 20 15:48:47 2018 +0000

  hv_netvsc: select needed ucs2_string routine

commit 16f4faa4f06ff3b4e214922d55ac33ab6e2bdbdc
Author: Srinivas Jampala <srinivasa.jampala@cavium.com>
Date: Tue Apr 24 17:23:27 2018 +0000

  liquidio: Swap VF representor Tx and Rx statistics

commit e0ada51db907ed2db5d46ad7ff86a8b5df68e59b
Author: David S. Miller <davem@davemloft.net>
Date: Sat Apr 21 20:31:52 2018 +0000

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

commit c749fa181bd5848be78691d23168ec61ce691b95
Author: David S. Miller <davem@davemloft.net>
Date: Wed Apr 25 03:59:11 2018 +0000

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fix bisection: fixed by (bisect log) :
commit a39c46067c845a8a2d7144836e9468b7f072343e
Author: Christoph Hellwig <hch@lst.de>
Date: Fri Jul 10 08:57:22 2020 +0000

  net/9p: validate fds in p9_fd_open

▶ ▼ Discussions (3)
Title Replies (including bot) Last reply
WARNING: refcount bug in p9_req_put 2 (5) 2020/11/11 13:54
Reminder: 18 open syzbot bugs in "fs/9p" subsystem 1 (1) 2019/07/24 01:46
Reminder: 18 open syzbot bugs in "fs/9p" subsystem 1 (1) 2019/07/02 06:29
▶ ▼ Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 WARNING: refcount bug in p9_req_put 13 2 2589d 2630d 0/1 auto-closed as invalid on 2020/02/28 21:29
upstream WARNING: refcount bug in p9_req_put (3) v9fs 13 syz, C 99 302d 1041d 0/30 auto-obsoleted due to no activity on 2026/05/15 00:21
upstream WARNING: refcount bug in p9_req_put (4) prio:high v9fs 13 syz, C 15 102d 179d 0/30 auto-obsoleted due to no activity on 2026/11/10 23:46
upstream WARNING: refcount bug in p9_req_put (2) v9fs 13 9 1189d 1535d 0/30 auto-obsoleted due to no activity on 2023/12/09 05:29
▶ ▼ Fix bisection attempts (8)
Created Duration User Patch Repo Result
2020/08/15 00:48 4h33m bisect fix upstream OK (1) job log
2020/05/21 09:31 31m bisect fix upstream OK (0) job log log
2020/04/21 08:59 31m bisect fix upstream OK (0) job log log
2020/03/22 08:28 30m bisect fix upstream OK (0) job log log
2020/01/28 00:58 32m bisect fix upstream OK (0) job log log
2019/12/18 21:24 30m bisect fix upstream OK (0) job log log
2019/11/09 19:30 32m bisect fix upstream OK (0) job log log
2019/08/22 22:41 31m bisect fix upstream OK (0) job log log

Sample crash report:
WARNING: CPU: 1 PID: 7959 at lib/refcount.c:190 refcount_sub_and_test_checked lib/refcount.c:190 [inline]
WARNING: CPU: 1 PID: 7959 at lib/refcount.c:190 refcount_sub_and_test_checked+0x1d0/0x200 lib/refcount.c:180
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 7959 Comm: syz-executor.1 Not tainted 5.1.0-rc7+ #96
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_sub_and_test_checked lib/refcount.c:190 [inline]
RIP: 0010:refcount_sub_and_test_checked+0x1d0/0x200 lib/refcount.c:180
Code: 1d c8 30 2a 06 31 ff 89 de e8 0c 32 40 fe 84 db 75 94 e8 c3 30 40 fe 48 c7 c7 60 79 a1 87 c6 05 a8 30 2a 06 01 e8 ae de 12 fe <0f> 0b e9 75 ff ff ff e8 a4 30 40 fe e9 6e ff ff ff 48 89 df e8 37
RSP: 0018:ffff888089ce7860 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff815afcb6 RDI: ffffed101139cefe
RBP: ffff888089ce78f8 R08: ffff8880a4c584c0 R09: ffffed1015d25011
R10: ffffed1015d25010 R11: ffff8880ae928087 R12: 00000000ffffffff
R13: 0000000000000001 R14: ffff888089ce78d0 R15: 0000000000000000
 refcount_dec_and_test_checked+0x1b/0x20 lib/refcount.c:220
 kref_put include/linux/kref.h:66 [inline]
 p9_req_put+0x20/0x60 net/9p/client.c:401
 p9_conn_destroy net/9p/trans_fd.c:880 [inline]
 p9_fd_close+0x2ee/0x570 net/9p/trans_fd.c:913
 p9_client_create+0x998/0x1400 net/9p/client.c:1083
 v9fs_session_init+0x1e7/0x1960 fs/9p/v9fs.c:421
 v9fs_mount+0x7d/0x920 fs/9p/vfs_super.c:135
 legacy_get_tree+0xf2/0x200 fs/fs_context.c:584
 vfs_get_tree+0x123/0x450 fs/super.c:1481
 do_new_mount fs/namespace.c:2622 [inline]
 do_mount+0x1436/0x2c40 fs/namespace.c:2942
 ksys_mount+0xdb/0x150 fs/namespace.c:3151
 __do_sys_mount fs/namespace.c:3165 [inline]
 __se_sys_mount fs/namespace.c:3162 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3162
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x458da9
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f2e68c68c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f2e68c68c90 RCX: 0000000000458da9
RDX: 0000000020000100 RSI: 00000000200000c0 RDI: 0000000000000000
RBP: 000000000073bf00 R08: 00000000200013c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2e68c696d4
R13: 00000000004c4da7 R14: 00000000004d8a20 R15: 0000000000000005
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/05/02 02:37 upstream 459e3a21535a 7516d9fa .config console log report syz ci-upstream-kasan-gce-root
2019/07/02 00:50 upstream 6fbc7275c7a9 cccc4302 .config console log report ci-upstream-kasan-gce-root
2019/06/21 02:17 upstream abf02e2964b3 34bf9440 .config console log report ci-upstream-kasan-gce-root
2019/05/02 01:47 upstream 459e3a21535a 7516d9fa .config console log report ci-upstream-kasan-gce-root
2018/11/14 00:53 upstream ccda4af0f4b9 5f5f6d14 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/09 03:36 linux-next cf08baa29613 12365b99 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.