Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e420aba3 authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Marcel Holtmann
Browse files

Bluetooth: Fix memory leak in L2CAP



Move skb_clone after error confition check so it is not going
potentially out of the scope.

Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@nokia.com>
Acked-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent fcafde2e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1368,7 +1368,6 @@ 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) {
@@ -1376,6 +1375,8 @@ static int l2cap_ertm_send(struct sock *sk)
			break;
		}

		tx_skb = skb_clone(skb, GFP_ATOMIC);

		bt_cb(skb)->retries++;

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