* [PATCH] Bluetooth: Fix memory leak in l2cap
@ 2009-12-23 11:17 Andrei Emeltchenko
2010-01-05 22:33 ` Gustavo F. Padovan
2010-01-07 3:47 ` Marcel Holtmann
0 siblings, 2 replies; 3+ messages in thread
From: Andrei Emeltchenko @ 2009-12-23 11:17 UTC (permalink / raw)
To: linux-bluetooth, Marcel Holtmann, Gustavo F. Padovan
[-- Attachment #1: Type: text/plain, Size: 978 bytes --]
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@nokia.com>
---
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
[-- Attachment #2: 0001-Bluetooth-Fix-memory-leak-in-l2cap.patch --]
[-- Type: text/x-patch, Size: 1152 bytes --]
From 7f0096a7f0d0d8a94c055373cb56bdf68e9b9fe6 Mon Sep 17 00:00:00 2001
From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
Date: Wed, 23 Dec 2009 13:07:14 +0200
Subject: [PATCH] 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: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Fix memory leak in l2cap
2009-12-23 11:17 [PATCH] Bluetooth: Fix memory leak in l2cap Andrei Emeltchenko
@ 2010-01-05 22:33 ` Gustavo F. Padovan
2010-01-07 3:47 ` Marcel Holtmann
1 sibling, 0 replies; 3+ messages in thread
From: Gustavo F. Padovan @ 2010-01-05 22:33 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth, Marcel Holtmann
On Wed, Dec 23, 2009 at 9:17 AM, Andrei Emeltchenko
<andrei.emeltchenko.news@gmail.com> 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@nokia.com>
> ---
> =A0net/bluetooth/l2cap.c | =A0 =A03 ++-
> =A01 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)
>
> =A0 =A0 =A0 =A0while ((skb =3D sk->sk_send_head) && (!l2cap_tx_window_ful=
l(sk)) &&
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 !(pi->conn_state & L2CAP_CONN_REMOTE_BUSY)) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 tx_skb =3D skb_clone(skb, GFP_ATOMIC);
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (pi->remote_max_tx &&
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bt_cb(skb)=
->retries =3D=3D pi->remote_max_tx) {
> @@ -1376,6 +1375,8 @@ static int l2cap_ertm_send(struct sock *sk)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
>
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tx_skb =3D skb_clone(skb, GFP_ATOMIC);
> +
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bt_cb(skb)->retries++;
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0control =3D get_unaligned_le16(tx_skb->dat=
a + L2CAP_HDR_SIZE);
> --
> 1.6.0.4
>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
--=20
Gustavo F. Padovan
http://padovan.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Fix memory leak in l2cap
2009-12-23 11:17 [PATCH] Bluetooth: Fix memory leak in l2cap Andrei Emeltchenko
2010-01-05 22:33 ` Gustavo F. Padovan
@ 2010-01-07 3:47 ` Marcel Holtmann
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2010-01-07 3:47 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth, Gustavo F. Padovan
Hi Andrei,
> Hi, Please check following patch (also attached)
>
> Move skb_clone after error confition check so it is not going
> potentially out of the scope.
patch has been applied. Thanks.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-07 3:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-23 11:17 [PATCH] Bluetooth: Fix memory leak in l2cap Andrei Emeltchenko
2010-01-05 22:33 ` Gustavo F. Padovan
2010-01-07 3:47 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).