Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c0cfe7faa12f189ef1024fce5a710791d0062355
Commit:     c0cfe7faa12f189ef1024fce5a710791d0062355
Parent:     81d84a94be8085475c3585596e52b06ccbedd922
Author:     G. Liakhovetski <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 8 19:15:17 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Fri Jun 8 19:15:17 2007 -0700

    [IrDA]: Fix Rx/Tx path race.
    
    From: G. Liakhovetski <[EMAIL PROTECTED]>
    
    We need to switch to NRM _before_ sending the final packet otherwise
    we might hit a race condition where we get the first packet from the
    peer while we're still in LAP_XMIT_P.
    
    Signed-off-by: Samuel Ortiz <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 include/net/irda/irlap.h |   17 +++++++++++++++++
 net/irda/irlap_event.c   |   18 ------------------
 net/irda/irlap_frame.c   |    3 +++
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index f0248fb..a3d370e 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -289,4 +289,21 @@ static inline void irlap_clear_disconnect(struct irlap_cb 
*self)
        self->disconnect_pending = FALSE;
 }
 
+/*
+ * Function irlap_next_state (self, state)
+ *
+ *    Switches state and provides debug information
+ *
+ */
+static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
+{
+       /*
+       if (!self || self->magic != LAP_MAGIC)
+               return;
+
+       IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
+       */
+       self->state = state;
+}
+
 #endif
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index 0b02073..71c8055 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -317,23 +317,6 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT 
event,
 }
 
 /*
- * Function irlap_next_state (self, state)
- *
- *    Switches state and provides debug information
- *
- */
-static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
-{
-       /*
-       if (!self || self->magic != LAP_MAGIC)
-               return;
-
-       IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
-       */
-       self->state = state;
-}
-
-/*
  * Function irlap_state_ndm (event, skb, frame)
  *
  *    NDM (Normal Disconnected Mode) state
@@ -1086,7 +1069,6 @@ static int irlap_state_xmit_p(struct irlap_cb *self, 
IRLAP_EVENT event,
                        } else {
                                /* Final packet of window */
                                irlap_send_data_primary_poll(self, skb);
-                               irlap_next_state(self, LAP_NRM_P);
 
                                /*
                                 * Make sure state machine does not try to send
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 3c5a68e..3013c49 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -798,16 +798,19 @@ void irlap_send_data_primary_poll(struct irlap_cb *self, 
struct sk_buff *skb)
                self->vs = (self->vs + 1) % 8;
                self->ack_required = FALSE;
 
+               irlap_next_state(self, LAP_NRM_P);
                irlap_send_i_frame(self, tx_skb, CMD_FRAME);
        } else {
                IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__);
 
                if (self->ack_required) {
                        irlap_send_ui_frame(self, skb_get(skb), self->caddr, 
CMD_FRAME);
+                       irlap_next_state(self, LAP_NRM_P);
                        irlap_send_rr_frame(self, CMD_FRAME);
                        self->ack_required = FALSE;
                } else {
                        skb->data[1] |= PF_BIT;
+                       irlap_next_state(self, LAP_NRM_P);
                        irlap_send_ui_frame(self, skb_get(skb), self->caddr, 
CMD_FRAME);
                }
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to