summary refs log tree commit diff
path: root/net/nfc/hci/hcp.c
diff options
context:
space:
mode:
authorEric Lapuyade <eric.lapuyade@linux.intel.com>2012-11-26 18:06:27 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-10 00:51:48 +0100
commitf0c9103813b3045bd5b43220b6a78c9908a45d24 (patch)
tree78422096c0728f84a43c057bcf6ffa185bd13190 /net/nfc/hci/hcp.c
parent5f4d6214ef5e9b1ff6a72ddfa387c1d72adfac98 (diff)
downloadlinux-f0c9103813b3045bd5b43220b6a78c9908a45d24.tar.gz
NFC: Fixed nfc core and hci unregistration and cleanup
When an adapter is removed, it will unregister itself from hci and/or
nfc core. In order to do that safely, work tasks must first be canceled
and prevented to be scheduled again, before the hci or nfc device can be
destroyed.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/hci/hcp.c')
-rw-r--r--net/nfc/hci/hcp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/nfc/hci/hcp.c b/net/nfc/hci/hcp.c
index bc308a7ca609..b6b4109f2343 100644
--- a/net/nfc/hci/hcp.c
+++ b/net/nfc/hci/hcp.c
@@ -105,6 +105,13 @@ int nfc_hci_hcp_message_tx(struct nfc_hci_dev *hdev, u8 pipe,
 	}
 
 	mutex_lock(&hdev->msg_tx_mutex);
+
+	if (hdev->shutting_down) {
+		err = -ESHUTDOWN;
+		mutex_unlock(&hdev->msg_tx_mutex);
+		goto out_skb_err;
+	}
+
 	list_add_tail(&cmd->msg_l, &hdev->msg_tx_queue);
 	mutex_unlock(&hdev->msg_tx_mutex);