--- x/net/nfc/nci/core.c +++ y/net/nfc/nci/core.c @@ -560,7 +560,8 @@ static int nci_close_device(struct nci_d */ mutex_lock(&ndev->req_lock); - if (!test_and_clear_bit(NCI_UP, &ndev->flags)) { + if (!test_and_clear_bit(NCI_UP, &ndev->flags) && + !test_bit(NCI_UNREG +1, &ndev->flags)) { /* Need to flush the cmd wq in case * there is a queued/running cmd_work */ @@ -601,6 +602,7 @@ static int nci_close_device(struct nci_d /* Clear flags except NCI_UNREG */ ndev->flags &= BIT(NCI_UNREG); + set_bit(NCI_UNREG +1, &ndev->flags); mutex_unlock(&ndev->req_lock);