Skip to content

Commit

Permalink
net: nfc: nci: Change the NCI close sequence
Browse files Browse the repository at this point in the history
If there is a NCI command in work queue after closing the NCI device at
nci_unregister_device, The NCI command timer starts at flush_workqueue
function and then NCI command timeout handler would be called 5 second
after flushing the NCI command work queue and destroying the queue.
At that time, the timeout handler would try to use NCI command work queue
that is destroyed already. it will causes the problem. To avoid this
abnormal situation, change the sequence to prevent the NCI command timeout
handler from being called after destroying the NCI command work queue.

Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bongsu Jeon authored and David S. Miller committed Jan 6, 2021
1 parent 8dc879a commit f011539
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/nfc/nci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,11 @@ static int nci_close_device(struct nci_dev *ndev)

clear_bit(NCI_INIT, &ndev->flags);

del_timer_sync(&ndev->cmd_timer);

/* Flush cmd wq */
flush_workqueue(ndev->cmd_wq);

del_timer_sync(&ndev->cmd_timer);

/* Clear flags */
ndev->flags = 0;

Expand Down

0 comments on commit f011539

Please sign in to comment.