From 3e6b0de8053ae724931799f1b5d4f009b9fc4b44 Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Tue, 23 Sep 2014 16:38:06 -0700 Subject: 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 Tested-by: Thierry Escande Signed-off-by: Mark A. Greer Signed-off-by: Samuel Ortiz --- net/nfc/digital_dep.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'net/nfc') 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, goto error; } + if (DIGITAL_NFC_DEP_NAD_BIT_SET(pfb)) { + rc = -EIO; + goto exit; + } + if (size > resp->len) { rc = -EIO; goto error; @@ -572,6 +577,11 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, goto exit; } + if (DIGITAL_NFC_DEP_NAD_BIT_SET(pfb)) { + rc = -EIO; + goto exit; + } + if (size > resp->len) { rc = -EIO; goto exit; -- cgit v1.2.3-58-ga151