summaryrefslogtreecommitdiff
path: root/net/nfc
diff options
context:
space:
mode:
authorMark Greer <mgreer@animalcreek.com>2017-06-15 20:46:15 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2017-06-23 01:19:59 +0300
commit7f9f171336baec8ec71d57b6d329bf8cea5c1562 (patch)
tree563e5510daff423dfba53b060ea6a31b2ba07172 /net/nfc
parentdcfca27faf6d19d2af530cfccee2fcdbcd836a2c (diff)
downloadlinux-7f9f171336baec8ec71d57b6d329bf8cea5c1562.tar.xz
NFC: digital: NFC-A SEL_RES must be one byte
Section 4.8.2 (SEL_RES Response) of NFC Forum's NFC Digital Protocol Technical Specification dated 2010-11-17 clearly states that the size of a SEL_RES Response is one byte. Enforce this restriction in the code. Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/digital_technology.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c
index 3cc3448da524..2021d1d58a75 100644
--- a/net/nfc/digital_technology.c
+++ b/net/nfc/digital_technology.c
@@ -27,6 +27,7 @@
#define DIGITAL_SDD_RES_CT 0x88
#define DIGITAL_SDD_RES_LEN 5
+#define DIGITAL_SEL_RES_LEN 1
#define DIGITAL_SEL_RES_NFCID1_COMPLETE(sel_res) (!((sel_res) & 0x04))
#define DIGITAL_SEL_RES_IS_T2T(sel_res) (!((sel_res) & 0x60))
@@ -299,7 +300,7 @@ static void digital_in_recv_sel_res(struct nfc_digital_dev *ddev, void *arg,
}
}
- if (!resp->len) {
+ if (resp->len != DIGITAL_SEL_RES_LEN) {
rc = -EIO;
goto exit;
}