Re: [PATCH] Bluetooth: Fix memory leak in l2cap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 23, 2009 at 9:17 AM, Andrei Emeltchenko
<andrei.emeltchenko.news@xxxxxxxxx> wrote:
> Hi, Please check following patch (also attached)
>
> Move skb_clone after error confition check so it is not going
> potentially out of the scope.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
> ---
>  net/bluetooth/l2cap.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index 1120cf1..b927045 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -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);
> --
> 1.6.0.4
>


Acked-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>



-- 
Gustavo F. Padovan
http://padovan.org
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux