aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-09-23 19:38:06 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-11-28 06:38:36 -0500
commit3e6b0de8053ae724931799f1b5d4f009b9fc4b44 (patch)
treeae0d1779f8765efecee4fdb552f5634992f2c0a1 /net/nfc
parent05afedcb89189df5cea30a13b2a5b4aa70572749 (diff)
NFC: digital: Ensure no NAD byte in DEP_REQ and DEP_RES frames
According to chapter 14 of the NFC-DEP Digital Protocol Spec., the NAD byte should never be present in DEP_REQ or DEP_RES frames. However, this is not enforced so add that enforcement code. Reviewed-by: Thierry Escande <thierry.escande@linux.intel.com> Tested-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Mark A. Greer <mgreer@animalcreek.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/digital_dep.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c
index 7d1c794556c3..d5e669b0dedf 100644
--- a/net/nfc/digital_dep.c
+++ b/net/nfc/digital_dep.c
@@ -420,6 +420,11 @@ static void digital_in_recv_dep_res(struct nfc_digital_dev *ddev, void *arg,
420 goto error; 420 goto error;
421 } 421 }
422 422
423 if (DIGITAL_NFC_DEP_NAD_BIT_SET(pfb)) {
424 rc = -EIO;
425 goto exit;
426 }
427
423 if (size > resp->len) { 428 if (size > resp->len) {
424 rc = -EIO; 429 rc = -EIO;
425 goto error; 430 goto error;
@@ -572,6 +577,11 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
572 goto exit; 577 goto exit;
573 } 578 }
574 579
580 if (DIGITAL_NFC_DEP_NAD_BIT_SET(pfb)) {
581 rc = -EIO;
582 goto exit;
583 }
584
575 if (size > resp->len) { 585 if (size > resp->len) {
576 rc = -EIO; 586 rc = -EIO;
577 goto exit; 587 goto exit;