Skip to content

Commit

Permalink
Bluetooth: Fix memory leak in L2CAP
Browse files Browse the repository at this point in the history
Move skb_clone after error confition check so it is not going
potentially out of the scope.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Andrei Emeltchenko authored and Marcel Holtmann committed Jan 30, 2010
1 parent fcafde2 commit e420aba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/bluetooth/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,14 +1368,15 @@ static int l2cap_ertm_send(struct sock *sk)

while ((skb = sk->sk_send_head) && (!l2cap_tx_window_full(sk)) &&
!(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) {
tx_skb = skb_clone(skb, GFP_ATOMIC);

if (pi->remote_max_tx &&
bt_cb(skb)->retries == pi->remote_max_tx) {
l2cap_send_disconn_req(pi->conn, sk);
break;
}

tx_skb = skb_clone(skb, GFP_ATOMIC);

bt_cb(skb)->retries++;

control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE);
Expand Down

0 comments on commit e420aba

Please sign in to comment.