WARNING: bad unlock balance in gtp_encap_enable_socket

Status: fixed on 2020/02/07 14:13
Fix commit: 776a81a024e7 gtp: fix bad unlock balance in gtp_encap_enable_socket
First crash: 1649d, last: 1647d
Fix bisection: fixed by (bisect log) :
commit 776a81a024e73e809af4d965ed397405062d4515
Author: Eric Dumazet <>
Date: Mon Jan 6 14:45:37 2020 +0000

  gtp: fix bad unlock balance in gtp_encap_enable_socket

Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING: bad unlock balance in gtp_encap_enable_socket net C done 8 1645d 1649d 15/27 fixed on 2020/02/18 14:31
linux-4.14 WARNING: bad unlock balance in gtp_encap_enable_socket C done 2 1646d 1649d 1/1 fixed on 2020/02/09 09:28

Sample crash report:
audit: type=1400 audit(1578257929.121:36): avc:  denied  { map } for  pid=8087 comm="syz-executor516" path="/root/syz-executor516459032" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
WARNING: bad unlock balance detected!
4.19.93-syzkaller #0 Not tainted
syz-executor516/8090 is trying to release lock (sk_lock-AF_INET6) at:
[<ffffffff84749c6f>] gtp_encap_enable_socket+0x13f/0x350 drivers/net/gtp.c:835
but there are no more locks to release!

other info that might help us debug this:
2 locks held by syz-executor516/8090:
 #0: 000000000ddd2905 (rtnl_mutex){+.+.}, at: rtnl_lock net/core/rtnetlink.c:77 [inline]
 #0: 000000000ddd2905 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x40a/0xb00 net/core/rtnetlink.c:4765
 #1: 000000001c1d287d (slock-AF_INET6){+...}, at: spin_lock_bh include/linux/spinlock.h:334 [inline]
 #1: 000000001c1d287d (slock-AF_INET6){+...}, at: release_sock+0x20/0x1c0 net/core/sock.c:2853

stack backtrace:
CPU: 0 PID: 8090 Comm: syz-executor516 Not tainted 4.19.93-syzkaller #0
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+0x197/0x210 lib/dump_stack.c:118
 print_unlock_imbalance_bug kernel/locking/lockdep.c:3464 [inline]
 print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3441
 __lock_release kernel/locking/lockdep.c:3674 [inline]
 lock_release+0x6cd/0xa30 kernel/locking/lockdep.c:3922
 sock_release_ownership include/net/sock.h:1471 [inline]
 release_sock+0x181/0x1c0 net/core/sock.c:2863
 gtp_encap_enable_socket+0x13f/0x350 drivers/net/gtp.c:835
 gtp_encap_enable drivers/net/gtp.c:857 [inline]
 gtp_newlink+0x9b7/0xc10 drivers/net/gtp.c:670
 rtnl_newlink+0x1042/0x1600 net/core/rtnetlink.c:3132
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4768
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4786
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
RIP: 0033:0x446c39
Code: e8 5c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 0b 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb2a66ebdb8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000006dbc38 RCX: 0000000000446c39
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00000000006dbc30 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000000008 R11: 0000000000000246 R12: 00000000006dbc3c
R13: 00007ffe46b1e6ff R14: 00007fb2a66ec9c0 R15: 20c49ba5e353f7cf

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/05 21:01 linux-4.19.y 3d40d7117e35 d646e21f .config console log report syz C ci2-linux-4-19
2020/01/08 07:25 linux-4.19.y 3d40d7117e35 6738e0b3 .config console log report syz ci2-linux-4-19
* Struck through repros no longer work on HEAD.