aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-05-10 18:34:11 -0400
committerMarcel Holtmann <marcel@holtmann.org>2010-07-21 13:39:04 -0400
commit8ff50ec04a7ecdbba6e0a5423cf6f2c5f7fc605e (patch)
tree49503c86fc8403d7a7dd95a5df4411ec8d3207c3 /net/bluetooth/l2cap.c
parentf6337c771126420c348b702e012262cfb5f0d56e (diff)
Bluetooth: Fix bug with ERTM vars increment
All ERTM operations regarding the txWindow should be modulo 64, otherwise we confuse the ERTM logic and connections will break. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi> Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r--net/bluetooth/l2cap.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 7e39d9ee0b9c..a9fdfe401f5b 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -3748,7 +3748,7 @@ static void l2cap_check_srej_gap(struct sock *sk, u8 tx_seq)
3748 l2cap_ertm_reassembly_sdu(sk, skb, control); 3748 l2cap_ertm_reassembly_sdu(sk, skb, control);
3749 l2cap_pi(sk)->buffer_seq_srej = 3749 l2cap_pi(sk)->buffer_seq_srej =
3750 (l2cap_pi(sk)->buffer_seq_srej + 1) % 64; 3750 (l2cap_pi(sk)->buffer_seq_srej + 1) % 64;
3751 tx_seq++; 3751 tx_seq = (tx_seq + 1) % 64;
3752 } 3752 }
3753} 3753}
3754 3754
@@ -3784,10 +3784,11 @@ static void l2cap_send_srejframe(struct sock *sk, u8 tx_seq)
3784 l2cap_send_sframe(pi, control); 3784 l2cap_send_sframe(pi, control);
3785 3785
3786 new = kzalloc(sizeof(struct srej_list), GFP_ATOMIC); 3786 new = kzalloc(sizeof(struct srej_list), GFP_ATOMIC);
3787 new->tx_seq = pi->expected_tx_seq++; 3787 new->tx_seq = pi->expected_tx_seq;
3788 pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64;
3788 list_add_tail(&new->list, SREJ_LIST(sk)); 3789 list_add_tail(&new->list, SREJ_LIST(sk));
3789 } 3790 }
3790 pi->expected_tx_seq++; 3791 pi->expected_tx_seq = (pi->expected_tx_seq + 1) % 64;
3791} 3792}
3792 3793
3793static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, struct sk_buff *skb) 3794static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, struct sk_buff *skb)