Thread (6 messages) 6 messages, 3 authors, 2009-12-15

Re: [PATCH 1/2] Bluetooth: Add locking scheme to timeout callbacks.

From: Gustavo F. Padovan <hidden>
Date: 2009-12-14 14:13:29

Hi,

On Mon, Dec 14, 2009 at 8:36 AM, Andrei Emeltchenko
[off-list ref] wrote:
Hi,

On Mon, Aug 24, 2009 at 5:45 AM, Gustavo F. Padovan
[off-list ref] wrote:
quoted
Avoid race conditions when acessing the sock.

Signed-off-by: Gustavo F. Padovan <redacted>
---
=A0net/bluetooth/l2cap.c | =A0 =A04 ++++
=A01 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index c04526f..efac637 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1192,6 +1192,7 @@ static void l2cap_monitor_timeout(unsigned long ar=
g)
quoted
=A0 =A0 =A0 =A0struct sock *sk =3D (void *) arg;
=A0 =A0 =A0 =A0u16 control;

+ =A0 =A0 =A0 bh_lock_sock(sk);
=A0 =A0 =A0 =A0if (l2cap_pi(sk)->retry_count >=3D l2cap_pi(sk)->remote_m=
ax_tx) {
quoted
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0l2cap_send_disconn_req(l2cap_pi(sk)->conn=
, sk);
missing unlock ?
quoted
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
@@ -1203,6 +1204,7 @@ static void l2cap_monitor_timeout(unsigned long ar=
g)
quoted hunk ↗ jump to hunk
quoted
=A0 =A0 =A0 =A0control =3D L2CAP_CTRL_POLL;
=A0 =A0 =A0 =A0control |=3D L2CAP_SUPER_RCV_READY;
=A0 =A0 =A0 =A0l2cap_send_sframe(l2cap_pi(sk), control);
+ =A0 =A0 =A0 bh_unlock_sock(sk);
=A0}
Please consider following patch:
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1208,6 +1208,7 @@ static void l2cap_monitor_timeout(unsigned long arg=
)
=A0 =A0 =A0 =A0bh_lock_sock(sk);
=A0 =A0 =A0 =A0if (l2cap_pi(sk)->retry_count >=3D l2cap_pi(sk)->remote_ma=
x_tx) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0l2cap_send_disconn_req(l2cap_pi(sk)->conn,=
 sk);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 bh_unlock_sock(sk);
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
=A0 =A0 =A0 =A0}


Also see complete patch attached.
Acked-by: Gustavo F. Padovan <redacted>
Regards,
Andrei Emeltchenko


--=20
Gustavo F. Padovan
http://padovan.org
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help