• Luciano Coelho's avatar
    cfg80211: fix deadlock with rfkill/sched_scan by adding new mutex · c10841ca
    Luciano Coelho authored
    There was a deadlock when rfkill-blocking a wireless interface,
    because we were locking the rdev mutex on NETDEV_GOING_DOWN to stop
    sched_scans that were eventually running.  The rfkill block code was
    already holding a mutex under rdev:
    
    kernel: =======================================================
    kernel: [ INFO: possible circular locking dependency detected ]
    kernel: 3.0.0-rc1-00049-g1fa7b6a2 #57
    kernel: -------------------------------------------------------
    kernel: kworker/0:1/4525 is trying to acquire lock:
    kernel: (&rdev->mtx){+.+.+.}, at: [<ffffffff8164c831>] cfg80211_netdev_notifier_call+0x131/0x5b0
    kernel:
    kernel: but task is already holding lock:
    kernel: (&rdev->devlist_mtx){+.+.+.}, at: [<ffffffff8164dcef>] cfg80211_rfkill_set_block+0x4f/0xa0
    kernel:
    kernel: which lock already depends on the new lock.
    
    To fix this, add a new mutex specifically for sched_scan, to protect
    the sched_scan_req element in the rdev struct, instead of using the
    global rdev mutex.
    Reported-by: default avatarDuane Griffin <duaneg@dghda.com>
    Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    c10841ca
core.c 25.8 KB