[PATCH 2/2] af_bluetooth.c debug

From: David Fries
Date: Sun Feb 27 2011 - 22:50:14 EST


---
net/bluetooth/af_bluetooth.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 8e910f1..57cd360 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -211,6 +211,18 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock)
continue;
}

+ if (bt_sk(parent)->defer_setup && sk->sk_state == BT_CONNECT2)
+ printk("%s, parent %p newsock %p, "
+ "defer_setup && BT_CONNECT2\n", __func__,
+ parent, newsock);
+ if (sk->sk_state == BT_CONNECTED)
+ printk("%s, parent %p newsock %p, "
+ "BT_CONNECTED\n", __func__,
+ parent, newsock);
+ if (!newsock)
+ printk("%s, parent %p newsock %p, "
+ "!newsock\n", __func__,
+ parent, newsock);
if ((bt_sk(parent)->defer_setup && sk->sk_state == BT_CONNECT2)
|| sk->sk_state == BT_CONNECTED || !newsock) {
bt_accept_unlink(sk);
--
1.7.2.3


> commit 743400e01a33779f93b79c84a1b0d1a2d27338c8
> Author: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>
> Date: Sun Feb 27 16:05:07 2011 -0300
>
> Bluetooth: Don't accept l2cap connection before info_rsp
>
> When using defer_setup accepting a connection before receive the L2CAP
> Info Response for the connection lead us to a crash in l2cap_conn_start(.
>
> Reported-by: David Fries <david@xxxxxxxxx>
> Reported-by: Liang Bao <tim.bao@xxxxxxxxx>
> Signed-off-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>
>
> diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
> index c4cf3f5..a8ca42b 100644
> --- a/net/bluetooth/af_bluetooth.c
> +++ b/net/bluetooth/af_bluetooth.c
> @@ -211,8 +211,8 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock)
> continue;
> }
>
> - if (sk->sk_state == BT_CONNECTED || !newsock ||
> - bt_sk(parent)->defer_setup) {
> + if ((bt_sk(parent)->defer_setup && sk->sk_state == BT_CONNECT2)
> + || sk->sk_state == BT_CONNECTED || !newsock) {
> bt_accept_unlink(sk);
> if (newsock)
> sock_graft(sk, newsock);
>
>
> --
> Gustavo F. Padovan
> http://profusion.mobi
> --
> 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

--
David Fries <david@xxxxxxxxx>
http://fries.net/~david/ (PGP encryption key available)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/