• Yang Shen's avatar
    crypto: hisilicon/qm - fix deadlock for remove driver · fc6c01f0
    Yang Shen authored
    When remove the driver and executing the task occur at the same time,
    the following deadlock will be triggered:
    
    Chain exists of:
        sva_lock --> uacce_mutex --> &qm->qps_lock
        Possible unsafe locking scenario:
    		CPU0                    CPU1
    		----                    ----
    	lock(&qm->qps_lock);
    					lock(uacce_mutex);
    					lock(&qm->qps_lock);
    	lock(sva_lock);
    
    And the lock 'qps_lock' is used to protect qp. Therefore, it's reasonable
    cycle is to continue until the qp memory is released. So move the release
    lock infront of 'uacce_remove'.
    Signed-off-by: default avatarYang Shen <shenyang39@huawei.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    fc6c01f0
qm.c 139 KB