diff options
author | Ilia Kolomisnky <iliak@ti.com> | 2011-07-15 14:30:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-16 13:14:44 -0400 |
commit | 05e9a2f67849e427f8900bad0a3f2a939e8dd3d6 (patch) | |
tree | 95048e1f1f0cff75d38792079d477f603b45a37c | |
parent | 9191e6ad897a8b4f0b89aea7c2d3c843f29a8630 (diff) |
Bluetooth: Fix crash with incoming L2CAP connections
Another regression fix considering incomming l2cap connections with
defer_setup enabled. In situations when incomming connection is
extracted with l2cap_sock_accept, it's bt_sock info will have
'parent' member zerroed, but 'parent' may be used unconditionally
in l2cap_conn_start() and l2cap_security_cfm() when defer_setup
is enabled.
Backtrace:
[<bf02d5ac>] (l2cap_security_cfm+0x0/0x2ac [bluetooth]) from [<bf01f01c>] (hci_event_pac
ket+0xc2c/0x4aa4 [bluetooth])
[<bf01e3f0>] (hci_event_packet+0x0/0x4aa4 [bluetooth]) from [<bf01a844>] (hci_rx_task+0x
cc/0x27c [bluetooth])
[<bf01a778>] (hci_rx_task+0x0/0x27c [bluetooth]) from [<c008eee4>] (tasklet_action+0xa0/
0x15c)
[<c008ee44>] (tasklet_action+0x0/0x15c) from [<c008f38c>] (__do_softirq+0x98/0x130)
r7:00000101 r6:00000018 r5:00000001 r4:efc46000
[<c008f2f4>] (__do_softirq+0x0/0x130) from [<c008f524>] (do_softirq+0x4c/0x58)
[<c008f4d8>] (do_softirq+0x0/0x58) from [<c008f5e0>] (run_ksoftirqd+0xb0/0x1b4)
r4:efc46000 r3:00000001
[<c008f530>] (run_ksoftirqd+0x0/0x1b4) from [<c009f2a8>] (kthread+0x84/0x8c)
r7:00000000 r6:c008f530 r5:efc47fc4 r4:efc41f08
[<c009f224>] (kthread+0x0/0x8c) from [<c008cc84>] (do_exit+0x0/0x5f0)
Signed-off-by: Ilia Kolomisnky <iliak@ti.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bluetooth/l2cap_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 4fbf67eda239..7705e26e699f 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -620,7 +620,8 @@ static void l2cap_conn_start(struct l2cap_conn *conn) | |||
620 | struct sock *parent = bt_sk(sk)->parent; | 620 | struct sock *parent = bt_sk(sk)->parent; |
621 | rsp.result = cpu_to_le16(L2CAP_CR_PEND); | 621 | rsp.result = cpu_to_le16(L2CAP_CR_PEND); |
622 | rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND); | 622 | rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND); |
623 | parent->sk_data_ready(parent, 0); | 623 | if (parent) |
624 | parent->sk_data_ready(parent, 0); | ||
624 | 625 | ||
625 | } else { | 626 | } else { |
626 | sk->sk_state = BT_CONFIG; | 627 | sk->sk_state = BT_CONFIG; |
@@ -4009,7 +4010,8 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4009 | struct sock *parent = bt_sk(sk)->parent; | 4010 | struct sock *parent = bt_sk(sk)->parent; |
4010 | res = L2CAP_CR_PEND; | 4011 | res = L2CAP_CR_PEND; |
4011 | stat = L2CAP_CS_AUTHOR_PEND; | 4012 | stat = L2CAP_CS_AUTHOR_PEND; |
4012 | parent->sk_data_ready(parent, 0); | 4013 | if (parent) |
4014 | parent->sk_data_ready(parent, 0); | ||
4013 | } else { | 4015 | } else { |
4014 | sk->sk_state = BT_CONFIG; | 4016 | sk->sk_state = BT_CONFIG; |
4015 | res = L2CAP_CR_SUCCESS; | 4017 | res = L2CAP_CR_SUCCESS; |