• Paul Moore's avatar
    selinux: correct locking in selinux_netlbl_socket_connect) · 34cc788a
    Paul Moore authored
    commit 42d64e1a upstream.
    
    The SELinux/NetLabel glue code has a locking bug that affects systems
    with NetLabel enabled, see the kernel error message below.  This patch
    corrects this problem by converting the bottom half socket lock to a
    more conventional, and correct for this call-path, lock_sock() call.
    
     ===============================
     [ INFO: suspicious RCU usage. ]
     3.11.0-rc3+ #19 Not tainted
     -------------------------------
     net/ipv4/cipso_ipv4.c:1928 suspicious rcu_dereference_protected() usage!
    
     other info that might help us debug this:
    
     rcu_scheduler_active = 1, debug_locks = 0
     2 locks held by ping/731:
      #0:  (slock-AF_INET/1){+.-...}, at: [...] selinux_netlbl_socket_connect
      #1:  (rcu_read_lock){.+.+..}, at: [<...>] netlbl_conn_setattr
    
     stack backtrace:
     CPU: 1 PID: 731 Comm: ping Not tainted 3.11.0-rc3+ #19
     Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      0000000000000001 ffff88006f659d28 fffff...
    34cc788a
netlabel.c 12.1 KB