diff mbox

[3/3] NFC: Clean rcv_q to avoid handling of remaing RSET

Message ID 1347437735-15041-3-git-send-email-waldemar.rymarkiewicz@tieto.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Waldemar Rymarkiewicz Sept. 12, 2012, 8:15 a.m. UTC
During processing incoming RSET frame chip, possibly due to its internal
timout, could retrnasmit an another RSET which is next queued for processing
in shdlc layer.

To avoid processing of those remaining in rcv_q purge the queue. Otherwise it
will be handled in CONNECTED state which will result in disconnection.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
---
 net/nfc/hci/shdlc.c |    6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/net/nfc/hci/shdlc.c b/net/nfc/hci/shdlc.c
index 12feb58..6ede86c 100644
--- a/net/nfc/hci/shdlc.c
+++ b/net/nfc/hci/shdlc.c
@@ -381,6 +381,12 @@  static void nfc_shdlc_rcv_u_frame(struct nfc_shdlc *shdlc,
 				shdlc->srej_support = srej_support;
 				r = nfc_shdlc_connect_send_ua(shdlc);
 				nfc_shdlc_connect_complete(shdlc, r);
+
+				if (shdlc->rcv_q.qlen)
+					/* Handling incoming RSET the chip could issue an another one,
+					 * possibly due to its internal timeout, so we have to make
+					 * sure we won't handle these remaining on the rcv_q */
+					skb_queue_purge(&shdlc->rcv_q);
 			}
 		} else if (shdlc->state == SHDLC_CONNECTED) {
 			/*