• Atul Gupta's avatar
    net/tls: sleeping function from invalid context · df9d4a17
    Atul Gupta authored
    HW unhash within mutex for registered tls devices cause sleep
    when called from tcp_set_state for TCP_CLOSE. Release lock and
    re-acquire after function call with ref count incr/dec.
    defined kref and fp release for tls_device to ensure device
    is not released outside lock.
    
    BUG: sleeping function called from invalid context at
    kernel/locking/mutex.c:748
    in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper/7
    INFO: lockdep is turned off.
    CPU: 7 PID: 0 Comm: swapper/7 Tainted: G        W  O
    Call Trace:
     <IRQ>
     dump_stack+0x5e/0x8b
     ___might_sleep+0x222/0x260
     __mutex_lock+0x5c/0xa50
     ? vprintk_emit+0x1f3/0x440
     ? kmem_cache_free+0x22d/0x2a0
     ? tls_hw_unhash+0x2f/0x80
     ? printk+0x52/0x6e
     ? tls_hw_unhash+0x2f/0x80
     tls_hw_unhash+0x2f/0x80
     tcp_set_state+0x5f/0x180
     tcp_done+0x2e/0xe0
     tcp_rcv_state_process+0x92c/0xdd3
     ? lock_acquire+0xf5/0x1f0
     ? tcp_v4_rcv+0xa7c/0xbe0
     ? tcp_v4_do_rcv+0x70/0x1e0
    Signed-off-by: default avatarAtul Gupta <atul.gupta@chelsio.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    df9d4a17
tls_main.c 17.3 KB