Skip to contentSkip to conversation

NFC fixes for 3.5

PATCH Superseded Samuel Ortiz 2 participants 6 messages Jul 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover NFC fixes for 3.5

Hi John,

The 3rd and hopefully last pull request for NFC fixes. You can pull them from:

git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-3.0.git tags/nfc-fixes-3.5-3

Dave Jones (1):
NFC: NCI module license 'unspecified' taints kernel

Eric Lapuyade (1):
NFC: Set target nfcid1 for all HCI reader A targets

 net/nfc/hci/core.c |   15 +++++++++++++++
 net/nfc/nci/core.c |    3 +++
 2 files changed, 18 insertions(+)
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/2 NFC: Set target nfcid1 for all HCI reader A targets

From: Eric Lapuyade <[email protected]>

---
 net/nfc/hci/core.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
net/nfc/hci/core.c +15 -0
index e1a640d..7b1ca7d 100644
@@ -170,6 +170,7 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
 	struct nfc_target *targets;
 	struct sk_buff *atqa_skb = NULL;
 	struct sk_buff *sak_skb = NULL;
+	struct sk_buff *uid_skb = NULL;
 	int r;
 
 	pr_debug("from gate %d\n", gate);
@@ -205,6 +206,19 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
 		targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data);
 		targets->sel_res = sak_skb->data[0];
 
+		r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE,
+				      NFC_HCI_RF_READER_A_UID, &uid_skb);
+		if (r < 0)
+			goto exit;
+
+		if (uid_skb->len == 0 || uid_skb->len > NFC_NFCID1_MAXSIZE) {
+			r = -EPROTO;
+			goto exit;
+		}
+
+		memcpy (targets->nfcid1, uid_skb->data, uid_skb->len);
+		targets->nfcid1_len = uid_skb->len;
+
 		if (hdev->ops->complete_target_discovered) {
 			r = hdev->ops->complete_target_discovered(hdev, gate,
 								  targets);
@@ -240,6 +254,7 @@ exit:
 	kfree(targets);
 	kfree_skb(atqa_skb);
 	kfree_skb(sak_skb);
+	kfree_skb(uid_skb);
 
 	return r;
 }
Signature · 1 line
1.7.10
#5 lore raw

PATCH 2/2 NFC: NCI module license 'unspecified' taints kernel

In reply to Samuel Ortiz

From: Dave Jones <[email protected]>

---
 net/nfc/nci/core.c |    3 +++
 1 file changed, 3 insertions(+)
net/nfc/nci/core.c +3 -0
index d560e6f..f18f207 100644
@@ -27,6 +27,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
 
+#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
 #include <linux/completion.h>
@@ -878,3 +879,5 @@ static void nci_cmd_work(struct work_struct *work)
 			  jiffies + msecs_to_jiffies(NCI_CMD_TIMEOUT));
 	}
 }
+
+MODULE_LICENSE("GPL");
Signature · 1 line
1.7.10
#2 lore raw

Re: [PATCH 1/2] NFC: Set target nfcid1 for all HCI reader A targets

In reply to Samuel Ortiz

What is the bug we are preventing with this?

Quoted 53 lines · Samuel Ortiz

From: Eric Lapuyade <[email protected]>

---
 net/nfc/hci/core.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
net/nfc/hci/core.c +15 -0
index e1a640d..7b1ca7d 100644
@@ -170,6 +170,7 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
 	struct nfc_target *targets;
 	struct sk_buff *atqa_skb = NULL;
 	struct sk_buff *sak_skb = NULL;
+	struct sk_buff *uid_skb = NULL;
 	int r;
 
 	pr_debug("from gate %d\n", gate);
@@ -205,6 +206,19 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
 		targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data);
 		targets->sel_res = sak_skb->data[0];
 
+		r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE,
+				      NFC_HCI_RF_READER_A_UID, &uid_skb);
+		if (r < 0)
+			goto exit;
+
+		if (uid_skb->len == 0 || uid_skb->len > NFC_NFCID1_MAXSIZE) {
+			r = -EPROTO;
+			goto exit;
+		}
+
+		memcpy (targets->nfcid1, uid_skb->data, uid_skb->len);
+		targets->nfcid1_len = uid_skb->len;
+
 		if (hdev->ops->complete_target_discovered) {
 			r = hdev->ops->complete_target_discovered(hdev, gate,
 								  targets);
@@ -240,6 +254,7 @@ exit:
 	kfree(targets);
 	kfree_skb(atqa_skb);
 	kfree_skb(sak_skb);
+	kfree_skb(uid_skb);
 
 	return r;
 }
Signature · 1 line
1.7.10
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#3 lore raw

Re: [PATCH 1/2] NFC: Set target nfcid1 for all HCI reader A targets

Hi John,

Quoted 1 line · John W. Linville

What is the bug we are preventing with this?

My bad for not having a proper changelog.
Let me send a new pull request to you with a better description.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#4 lore raw

PATCH v2 1/2 NFC: Set target nfcid1 for all HCI reader A targets

In reply to Samuel Ortiz

From: Eric Lapuyade <[email protected]>

Without the discovered target nfcid1 and its length set properly, type 2 tags detection fails with the pn544 as it checks for them from pn544_hci_complete_target_discovered().

---
v2: Add proper changelog and fix a checkpatch warning

---
 net/nfc/hci/core.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
net/nfc/hci/core.c +15 -0
index e1a640d..c48f534 100644
@@ -170,6 +170,7 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
 	struct nfc_target *targets;
 	struct sk_buff *atqa_skb = NULL;
 	struct sk_buff *sak_skb = NULL;
+	struct sk_buff *uid_skb = NULL;
 	int r;
 
 	pr_debug("from gate %d\n", gate);
@@ -205,6 +206,19 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate)
 		targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data);
 		targets->sel_res = sak_skb->data[0];
 
+		r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE,
+				      NFC_HCI_RF_READER_A_UID, &uid_skb);
+		if (r < 0)
+			goto exit;
+
+		if (uid_skb->len == 0 || uid_skb->len > NFC_NFCID1_MAXSIZE) {
+			r = -EPROTO;
+			goto exit;
+		}
+
+		memcpy(targets->nfcid1, uid_skb->data, uid_skb->len);
+		targets->nfcid1_len = uid_skb->len;
+
 		if (hdev->ops->complete_target_discovered) {
 			r = hdev->ops->complete_target_discovered(hdev, gate,
 								  targets);
@@ -240,6 +254,7 @@ exit:
 	kfree(targets);
 	kfree_skb(atqa_skb);
 	kfree_skb(sak_skb);
+	kfree_skb(uid_skb);
 
 	return r;
 }
Signature · 5 lines
1.7.10

-- 
Intel Open Source Technology Centre
http://oss.intel.com/