NFC: Handle SHDLC RSET frames from an SHDLC connected chip
authorEric Lapuyade <eric.lapuyade@intel.com>
Wed, 2 May 2012 09:23:11 +0000 (11:23 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Jul 2012 20:42:05 +0000 (16:42 -0400)
shdlc reset may leave HCI in an inconsistent state by loosing parts of
HCI frames. Handle this case by reporting an unrecoverable error to HCI.

Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/hci/shdlc.c

index 18d1536df5f68b6a9cc57edfa2d84c958d960ae3..6f840c18c892e351adc19f30e3a16513751d4f77 100644 (file)
@@ -404,12 +404,12 @@ static void nfc_shdlc_rcv_u_frame(struct nfc_shdlc *shdlc,
                                r = nfc_shdlc_connect_send_ua(shdlc);
                                nfc_shdlc_connect_complete(shdlc, r);
                        }
-               } else if (shdlc->state > SHDLC_NEGOCIATING) {
+               } else if (shdlc->state == SHDLC_CONNECTED) {
                        /*
-                        * TODO: Chip wants to reset link
-                        * send ua, empty skb lists, reset counters
-                        * propagate info to HCI layer
+                        * Chip wants to reset link. This is unexpected and
+                        * unsupported.
                         */
+                       shdlc->hard_fault = -ECONNRESET;
                }
                break;
        case U_FRAME_UA: