net: nfc: nci: Change the NCI close sequence
authorBongsu Jeon <bongsu.jeon@samsung.com>
Thu, 31 Dec 2020 02:59:26 +0000 (11:59 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 09:39:17 +0000 (10:39 +0100)
commitb2a60b4a0195ba918ce924ba0616048ce09a3cc5
tree9ded9b6a71892deb7e7a9598b4e8f692a6e6ffa5
parent73a0d12114b4bc1a9def79a623264754b9df698e
net: nfc: nci: Change the NCI close sequence

[ Upstream commit f011539e723c737b74876ac47345e40270a3c384 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/nfc/nci/core.c