--- x/net/nfc/nci/core.c +++ y/net/nfc/nci/core.c @@ -560,6 +560,10 @@ static int nci_close_device(struct nci_d */ mutex_lock(&ndev->req_lock); + if (test_and_set_bit(NCI_UNREG +1, &ndev->flags)) { + mutex_unlock(&ndev->req_lock); + return 0; + } if (!test_and_clear_bit(NCI_UP, &ndev->flags)) { /* Need to flush the cmd wq in case * there is a queued/running cmd_work @@ -601,6 +605,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);