Bluetooth: Fix bug when retransmitting I-frames
If there is no frames to retransmit l2cap was crashing the kernel, now we check if the queue is empty first. 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>
This commit is contained in:
parent
68d7f0ce91
commit
f6e6b16823
@ -3546,7 +3546,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
|
|||||||
if (pi->conn_state & L2CAP_CONN_REJ_ACT)
|
if (pi->conn_state & L2CAP_CONN_REJ_ACT)
|
||||||
pi->conn_state &= ~L2CAP_CONN_REJ_ACT;
|
pi->conn_state &= ~L2CAP_CONN_REJ_ACT;
|
||||||
else {
|
else {
|
||||||
sk->sk_send_head = TX_QUEUE(sk)->next;
|
if (!skb_queue_empty(TX_QUEUE(sk)))
|
||||||
|
sk->sk_send_head = TX_QUEUE(sk)->next;
|
||||||
pi->next_tx_seq = pi->expected_ack_seq;
|
pi->next_tx_seq = pi->expected_ack_seq;
|
||||||
l2cap_ertm_send(sk);
|
l2cap_ertm_send(sk);
|
||||||
}
|
}
|
||||||
@ -3593,7 +3594,8 @@ static inline void l2cap_data_channel_rrframe(struct sock *sk, u16 rx_control)
|
|||||||
if (pi->conn_state & L2CAP_CONN_REJ_ACT)
|
if (pi->conn_state & L2CAP_CONN_REJ_ACT)
|
||||||
pi->conn_state &= ~L2CAP_CONN_REJ_ACT;
|
pi->conn_state &= ~L2CAP_CONN_REJ_ACT;
|
||||||
else {
|
else {
|
||||||
sk->sk_send_head = TX_QUEUE(sk)->next;
|
if (!skb_queue_empty(TX_QUEUE(sk)))
|
||||||
|
sk->sk_send_head = TX_QUEUE(sk)->next;
|
||||||
pi->next_tx_seq = pi->expected_ack_seq;
|
pi->next_tx_seq = pi->expected_ack_seq;
|
||||||
l2cap_ertm_send(sk);
|
l2cap_ertm_send(sk);
|
||||||
}
|
}
|
||||||
@ -3625,12 +3627,14 @@ static inline void l2cap_data_channel_rejframe(struct sock *sk, u16 rx_control)
|
|||||||
if (pi->conn_state & L2CAP_CONN_REJ_ACT)
|
if (pi->conn_state & L2CAP_CONN_REJ_ACT)
|
||||||
pi->conn_state &= ~L2CAP_CONN_REJ_ACT;
|
pi->conn_state &= ~L2CAP_CONN_REJ_ACT;
|
||||||
else {
|
else {
|
||||||
sk->sk_send_head = TX_QUEUE(sk)->next;
|
if (!skb_queue_empty(TX_QUEUE(sk)))
|
||||||
|
sk->sk_send_head = TX_QUEUE(sk)->next;
|
||||||
pi->next_tx_seq = pi->expected_ack_seq;
|
pi->next_tx_seq = pi->expected_ack_seq;
|
||||||
l2cap_ertm_send(sk);
|
l2cap_ertm_send(sk);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sk->sk_send_head = TX_QUEUE(sk)->next;
|
if (!skb_queue_empty(TX_QUEUE(sk)))
|
||||||
|
sk->sk_send_head = TX_QUEUE(sk)->next;
|
||||||
pi->next_tx_seq = pi->expected_ack_seq;
|
pi->next_tx_seq = pi->expected_ack_seq;
|
||||||
l2cap_ertm_send(sk);
|
l2cap_ertm_send(sk);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user