• Szymon Janc's avatar
    NFC: Fix sleeping in atomic when releasing socket · 50b78b2a
    Szymon Janc authored
    nfc_llcp_socket_release is calling lock_sock/release_sock while holding
    write lock for rwlock. Use bh_lock/unlock_sock instead.
    
    BUG: sleeping function called from invalid context at net/core/sock.c:2138
    in_atomic(): 1, irqs_disabled(): 0, pid: 56, name: kworker/1:1
    4 locks held by kworker/1:1/56:
    Pid: 56, comm: kworker/1:1 Not tainted 3.5.0-999-nfc+ #7
    Call Trace:
    [<ffffffff810952c5>] __might_sleep+0x145/0x200
    [<ffffffff815d7686>] lock_sock_nested+0x36/0xa0
    [<ffffffff81731569>] ? _raw_write_lock+0x49/0x50
    [<ffffffffa04aa100>] ? nfc_llcp_socket_release+0x30/0x200 [nfc]
    [<ffffffffa04aa122>] nfc_llcp_socket_release+0x52/0x200 [nfc]
    [<ffffffffa04ab9f0>] nfc_llcp_mac_is_down+0x20/0x30 [nfc]
    [<ffffffffa04a6fea>] nfc_dep_link_down+0xaa/0xf0 [nfc]
    [<ffffffffa04a9bb5>] nfc_llcp_timeout_work+0x15/0x20 [nfc]
    [<ffffffff810825f7>] process_one_work+0x197/0x7c0
    [<ffffffff81082596>] ? process_one_work+0x136/0x7c0
    [<ffffffff8172fbc9>] ? __schedule+0x419/0x9c0
    [<ffffffffa04a9ba0>] ? nfc_llcp_build_gb+0x1b0/0x1b0 [nfc]
    [<ffffffff81083090>] worker_thread+0x190/0x4c0
    [<ffffffff81082f00>] ? rescuer_thread+0x2a0/0x2a0
    [<ffffffff81088d1e>] kthread+0xae/0xc0
    [<ffffffff810caafd>] ? trace_hardirqs_on+0xd/0x10
    [<ffffffff8173acc4>] kernel_thread_helper+0x4/0x10
    [<ffffffff81732174>] ? retint_restore_args+0x13/0x13
    [<ffffffff81088c70>] ? flush_kthread_worker+0x150/0x150
    [<ffffffff8173acc0>] ? gs_change+0x13/0x13
    Signed-off-by: default avatarSzymon Janc <szymon.janc@tieto.com>
    Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
    50b78b2a
llcp.c 25.9 KB