lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1421940460-14049-5-git-send-email-clement.perrochaud@effinnov.com>
Date:	Thu, 22 Jan 2015 16:27:40 +0100
From:	clement.perrochaud@...innov.com
To:	linux-nfc@...ts.01.org
Cc:	Clément Perrochaud <clement.perrochaud@....com>,
	sunil.jogi@....com, jerome.pele@....com,
	Charles.Gorand-Effinnov@....com, lauro.venancio@...nbossa.org,
	aloisio.almeida@...nbossa.org, sameo@...ux.intel.com,
	robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	davem@...emloft.net, grant.likely@...aro.org, lefrique@...vell.com,
	christophe.ricard@...il.com, cuissard@...vell.com,
	bzhao@...vell.com, hirent@...vell.com, akarwar@...vell.com,
	linux-wireless@...r.kernel.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	Clément Perrochaud 
	<clement.perrochaud@...innov.com>
Subject: [PATCH 4/4] NFC: nxp-nci: Allow module removal during download

From: Clément Perrochaud <clement.perrochaud@....com>

Signed-off-by: Clément Perrochaud <clement.perrochaud@....com>
Signed-off-by: Clément Perrochaud <clement.perrochaud@...innov.com>
---
 drivers/nfc/nxp-nci/core.c     | 7 +++----
 drivers/nfc/nxp-nci/firmware.c | 9 ++++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index d3643ef..c15606d 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -165,12 +165,11 @@ void nxp_nci_remove(struct nci_dev *ndev)
 {
 	struct nxp_nci_info *info = nci_get_drvdata(ndev);
 
-	mutex_lock(&info->info_lock);
-
-	cancel_work_sync(&info->fw_info.work);
-
 	if (info->mode == NXP_NCI_MODE_FW)
 		nxp_nci_fw_work_complete(info, -ESHUTDOWN);
+	cancel_work_sync(&info->fw_info.work);
+
+	mutex_lock(&info->info_lock);
 
 	if (info->phy_ops->disable)
 		info->phy_ops->disable(info->phy_id);
diff --git a/drivers/nfc/nxp-nci/firmware.c b/drivers/nfc/nxp-nci/firmware.c
index 1814e9f..de136e1 100644
--- a/drivers/nfc/nxp-nci/firmware.c
+++ b/drivers/nfc/nxp-nci/firmware.c
@@ -166,7 +166,8 @@ static int nxp_nci_fw_send(struct nxp_nci_info *info)
 
 	if (*fw_info->data == NXP_NCI_FW_CMD_RESET) {
 		fw_info->cmd_result = 0;
-		schedule_work(&fw_info->work);
+		if (fw_info->fw)
+			schedule_work(&fw_info->work);
 	} else {
 		completion_rc = wait_for_completion_interruptible_timeout(
 			&fw_info->cmd_completion, NXP_NCI_FW_ANSWER_TIMEOUT);
@@ -244,7 +245,8 @@ int nxp_nci_fw_download(struct nci_dev *ndev, const char *firmware_name)
 	fw_info->frame_size = 0;
 	fw_info->cmd_result = 0;
 
-	schedule_work(&fw_info->work);
+	if (fw_info->fw)
+		schedule_work(&fw_info->work);
 
 fw_download_exit:
 	mutex_unlock(&info->info_lock);
@@ -316,6 +318,7 @@ void nxp_nci_fw_recv_frame(struct nci_dev *ndev, struct sk_buff *skb)
 		fw_info->cmd_result = -EIO;
 	}
 
-	schedule_work(&fw_info->work);
+	if (fw_info->fw)
+		schedule_work(&fw_info->work);
 }
 EXPORT_SYMBOL(nxp_nci_fw_recv_frame);
-- 
Clément Perrochaud

Eff'Innov Technologies
Caen, Aix-En-Provence, Grenoble

Eff'Innov Technologies
Campus EffiScience
2, Esplanade Anton Philips
14460 Colombelles, FRANCE

http://www.effinnov.com

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ