• Eric Dumazet's avatar
    netlink: netlink_diag_dump() runs without locks · 93636d1f
    Eric Dumazet authored
    A recent commit removed locking from netlink_diag_dump() but forgot
    one error case.
    
    =====================================
    [ BUG: bad unlock balance detected! ]
    4.9.0-rc3+ #336 Not tainted
    -------------------------------------
    syz-executor/4018 is trying to release lock ([   36.220068] nl_table_lock
    ) at:
    [<ffffffff82dc8683>] netlink_diag_dump+0x1a3/0x250 net/netlink/diag.c:182
    but there are no more locks to release!
    
    other info that might help us debug this:
    3 locks held by syz-executor/4018:
     #0: [   36.220068]  (
    sock_diag_mutex[   36.220068] ){+.+.+.}
    , at: [   36.220068] [<ffffffff82c3873b>] sock_diag_rcv+0x1b/0x40
     #1: [   36.220068]  (
    sock_diag_table_mutex[   36.220068] ){+.+.+.}
    , at: [   36.220068] [<ffffffff82c38e00>] sock_diag_rcv_msg+0x140/0x3a0
     #2: [   36.220068]  (
    nlk->cb_mutex[   36.220068] ){+.+.+.}
    , at: [   36.220068] [<ffffffff82db6600>] netlink_dump+0x50/0xac0
    
    stack backtrace:
    CPU: 1 PID: 4018 Comm: syz-executor Not tainted 4.9.0-rc3+...
    93636d1f
diag.c 4.72 KB