diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-04-24 17:19:32 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-05-04 18:06:27 -0400 |
commit | 3096e25a3e40b73afd59e46f3bf8d84f919992a1 (patch) | |
tree | b488b5f7614b5d9b24ad903b7e515b0c4673de5a /drivers/nfc | |
parent | 0bb8a622d6b47e4dde9ec877029f9e64a997c57f (diff) |
NFC: st21nfca: Fix incorrect byte stuffing revocation
Byte stuffing was not correctly removed after a i2c read operation.
This was causing improper crc calculation when byte stuffing was
applied to more than 1 byte.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/st21nfca/i2c.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index 6c4d0a0fc7fc..4df15ef2528a 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c | |||
@@ -315,11 +315,10 @@ static int st21nfca_hci_i2c_repack(struct sk_buff *skb) | |||
315 | skb_trim(skb, size); | 315 | skb_trim(skb, size); |
316 | /* remove ST21NFCA byte stuffing for upper layer */ | 316 | /* remove ST21NFCA byte stuffing for upper layer */ |
317 | for (i = 1, j = 0; i < skb->len; i++) { | 317 | for (i = 1, j = 0; i < skb->len; i++) { |
318 | if (skb->data[i] == | 318 | if (skb->data[i + j] == |
319 | (u8) ST21NFCA_ESCAPE_BYTE_STUFFING) { | 319 | (u8) ST21NFCA_ESCAPE_BYTE_STUFFING) { |
320 | skb->data[i] = | 320 | skb->data[i] = skb->data[i + j + 1] |
321 | skb->data[i + | 321 | | ST21NFCA_BYTE_STUFFING_MASK; |
322 | 1] | ST21NFCA_BYTE_STUFFING_MASK; | ||
323 | i++; | 322 | i++; |
324 | j++; | 323 | j++; |
325 | } | 324 | } |