<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/net/bluetooth/sco.c, branch v3.9.8</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>Bluetooth: SCO - Fix missing msg_namelen update in sco_sock_recvmsg()</title>
<updated>2013-04-07T20:28:01+00:00</updated>
<author>
<name>Mathias Krause</name>
<email>minipli@googlemail.com</email>
</author>
<published>2013-04-07T01:51:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c8c499175f7d295ef867335bceb9a76a2c3cdc38'/>
<id>c8c499175f7d295ef867335bceb9a76a2c3cdc38</id>
<content type='text'>
If the socket is in state BT_CONNECT2 and BT_SK_DEFER_SETUP is set in
the flags, sco_sock_recvmsg() returns early with 0 without updating the
possibly set msg_namelen member. This, in turn, leads to a 128 byte
kernel stack leak in net/socket.c.

Fix this by updating msg_namelen in this case. For all other cases it
will be handled in bt_sock_recvmsg().

Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Cc: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Cc: Johan Hedberg &lt;johan.hedberg@gmail.com&gt;
Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the socket is in state BT_CONNECT2 and BT_SK_DEFER_SETUP is set in
the flags, sco_sock_recvmsg() returns early with 0 without updating the
possibly set msg_namelen member. This, in turn, leads to a 128 byte
kernel stack leak in net/socket.c.

Fix this by updating msg_namelen in this case. For all other cases it
will be handled in bt_sock_recvmsg().

Cc: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Cc: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Cc: Johan Hedberg &lt;johan.hedberg@gmail.com&gt;
Signed-off-by: Mathias Krause &lt;minipli@googlemail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth</title>
<updated>2013-03-18T19:17:11+00:00</updated>
<author>
<name>John W. Linville</name>
<email>linville@tuxdriver.com</email>
</author>
<published>2013-03-18T19:17:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8fa48cbdfb0b7c2e39a8f2a46f987afe9b9c0579'/>
<id>8fa48cbdfb0b7c2e39a8f2a46f987afe9b9c0579</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Fix not closing SCO sockets in the BT_CONNECT2 state</title>
<updated>2013-03-14T16:14:21+00:00</updated>
<author>
<name>Vinicius Costa Gomes</name>
<email>vinicius.gomes@openbossa.org</email>
</author>
<published>2013-03-13T22:46:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=eb20ff9c91ddcb2d55c1849a87d3db85af5e88a9'/>
<id>eb20ff9c91ddcb2d55c1849a87d3db85af5e88a9</id>
<content type='text'>
With deferred setup for SCO, it is possible that userspace closes the
socket when it is in the BT_CONNECT2 state, after the Connect Request is
received but before the Accept Synchonous Connection is sent.

If this happens the following crash was observed, when the connection is
terminated:

[  +0.000003] hci_sync_conn_complete_evt: hci0 status 0x10
[  +0.000005] sco_connect_cfm: hcon ffff88003d1bd800 bdaddr 40:98:4e:32:d7:39 status 16
[  +0.000003] sco_conn_del: hcon ffff88003d1bd800 conn ffff88003cc8e300, err 110
[  +0.000015] BUG: unable to handle kernel NULL pointer dereference at 0000000000000199
[  +0.000906] IP: [&lt;ffffffff810620dd&gt;] __lock_acquire+0xed/0xe82
[  +0.000000] PGD 3d21f067 PUD 3d291067 PMD 0
[  +0.000000] Oops: 0002 [#1] SMP
[  +0.000000] Modules linked in: rfcomm bnep btusb bluetooth
[  +0.000000] CPU 0
[  +0.000000] Pid: 1481, comm: kworker/u:2H Not tainted 3.9.0-rc1-25019-gad82cdd #1 Bochs Bochs
[  +0.000000] RIP: 0010:[&lt;ffffffff810620dd&gt;]  [&lt;ffffffff810620dd&gt;] __lock_acquire+0xed/0xe82
[  +0.000000] RSP: 0018:ffff88003c3c19d8  EFLAGS: 00010002
[  +0.000000] RAX: 0000000000000001 RBX: 0000000000000246 RCX: 0000000000000000
[  +0.000000] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88003d1be868
[  +0.000000] RBP: ffff88003c3c1a98 R08: 0000000000000002 R09: 0000000000000000
[  +0.000000] R10: ffff88003d1be868 R11: ffff88003e20b000 R12: 0000000000000002
[  +0.000000] R13: ffff88003aaa8000 R14: 000000000000006e R15: ffff88003d1be850
[  +0.000000] FS:  0000000000000000(0000) GS:ffff88003e200000(0000) knlGS:0000000000000000
[  +0.000000] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  +0.000000] CR2: 0000000000000199 CR3: 000000003c1cb000 CR4: 00000000000006b0
[  +0.000000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  +0.000000] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  +0.000000] Process kworker/u:2H (pid: 1481, threadinfo ffff88003c3c0000, task ffff88003aaa8000)
[  +0.000000] Stack:
[  +0.000000]  ffffffff81b16342 0000000000000000 0000000000000000 ffff88003d1be868
[  +0.000000]  ffffffff00000000 00018c0c7863e367 000000003c3c1a28 ffffffff8101efbd
[  +0.000000]  0000000000000000 ffff88003e3d2400 ffff88003c3c1a38 ffffffff81007c7a
[  +0.000000] Call Trace:
[  +0.000000]  [&lt;ffffffff8101efbd&gt;] ? kvm_clock_read+0x34/0x3b
[  +0.000000]  [&lt;ffffffff81007c7a&gt;] ? paravirt_sched_clock+0x9/0xd
[  +0.000000]  [&lt;ffffffff81007fd4&gt;] ? sched_clock+0x9/0xb
[  +0.000000]  [&lt;ffffffff8104fd7a&gt;] ? sched_clock_local+0x12/0x75
[  +0.000000]  [&lt;ffffffff810632d1&gt;] lock_acquire+0x93/0xb1
[  +0.000000]  [&lt;ffffffffa0022339&gt;] ? spin_lock+0x9/0xb [bluetooth]
[  +0.000000]  [&lt;ffffffff8105f3d8&gt;] ? lock_release_holdtime.part.22+0x4e/0x55
[  +0.000000]  [&lt;ffffffff814f6038&gt;] _raw_spin_lock+0x40/0x74
[  +0.000000]  [&lt;ffffffffa0022339&gt;] ? spin_lock+0x9/0xb [bluetooth]
[  +0.000000]  [&lt;ffffffff814f6936&gt;] ? _raw_spin_unlock+0x23/0x36
[  +0.000000]  [&lt;ffffffffa0022339&gt;] spin_lock+0x9/0xb [bluetooth]
[  +0.000000]  [&lt;ffffffffa00230cc&gt;] sco_conn_del+0x76/0xbb [bluetooth]
[  +0.000000]  [&lt;ffffffffa002391d&gt;] sco_connect_cfm+0x2da/0x2e9 [bluetooth]
[  +0.000000]  [&lt;ffffffffa000862a&gt;] hci_proto_connect_cfm+0x38/0x65 [bluetooth]
[  +0.000000]  [&lt;ffffffffa0008d30&gt;] hci_sync_conn_complete_evt.isra.79+0x11a/0x13e [bluetooth]
[  +0.000000]  [&lt;ffffffffa000cd96&gt;] hci_event_packet+0x153b/0x239d [bluetooth]
[  +0.000000]  [&lt;ffffffff814f68ff&gt;] ? _raw_spin_unlock_irqrestore+0x48/0x5c
[  +0.000000]  [&lt;ffffffffa00025f6&gt;] hci_rx_work+0xf3/0x2e3 [bluetooth]
[  +0.000000]  [&lt;ffffffff8103efed&gt;] process_one_work+0x1dc/0x30b
[  +0.000000]  [&lt;ffffffff8103ef83&gt;] ? process_one_work+0x172/0x30b
[  +0.000000]  [&lt;ffffffff8103e07f&gt;] ? spin_lock_irq+0x9/0xb
[  +0.000000]  [&lt;ffffffff8103fc8d&gt;] worker_thread+0x123/0x1d2
[  +0.000000]  [&lt;ffffffff8103fb6a&gt;] ? manage_workers+0x240/0x240
[  +0.000000]  [&lt;ffffffff81044211&gt;] kthread+0x9d/0xa5
[  +0.000000]  [&lt;ffffffff81044174&gt;] ? __kthread_parkme+0x60/0x60
[  +0.000000]  [&lt;ffffffff814f75bc&gt;] ret_from_fork+0x7c/0xb0
[  +0.000000]  [&lt;ffffffff81044174&gt;] ? __kthread_parkme+0x60/0x60
[  +0.000000] Code: d7 44 89 8d 50 ff ff ff 4c 89 95 58 ff ff ff e8 44 fc ff ff 44 8b 8d 50 ff ff ff 48 85 c0 4c 8b 95 58 ff ff ff 0f 84 7a 04 00 00 &lt;f0&gt; ff 80 98 01 00 00 83 3d 25 41 a7 00 00 45 8b b5 e8 05 00 00
[  +0.000000] RIP  [&lt;ffffffff810620dd&gt;] __lock_acquire+0xed/0xe82
[  +0.000000]  RSP &lt;ffff88003c3c19d8&gt;
[  +0.000000] CR2: 0000000000000199
[  +0.000000] ---[ end trace e73cd3b52352dd34 ]---

Cc: stable@vger.kernel.org [3.8]
Signed-off-by: Vinicius Costa Gomes &lt;vinicius.gomes@openbossa.org&gt;
Tested-by: Frederic Dalleau &lt;frederic.dalleau@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With deferred setup for SCO, it is possible that userspace closes the
socket when it is in the BT_CONNECT2 state, after the Connect Request is
received but before the Accept Synchonous Connection is sent.

If this happens the following crash was observed, when the connection is
terminated:

[  +0.000003] hci_sync_conn_complete_evt: hci0 status 0x10
[  +0.000005] sco_connect_cfm: hcon ffff88003d1bd800 bdaddr 40:98:4e:32:d7:39 status 16
[  +0.000003] sco_conn_del: hcon ffff88003d1bd800 conn ffff88003cc8e300, err 110
[  +0.000015] BUG: unable to handle kernel NULL pointer dereference at 0000000000000199
[  +0.000906] IP: [&lt;ffffffff810620dd&gt;] __lock_acquire+0xed/0xe82
[  +0.000000] PGD 3d21f067 PUD 3d291067 PMD 0
[  +0.000000] Oops: 0002 [#1] SMP
[  +0.000000] Modules linked in: rfcomm bnep btusb bluetooth
[  +0.000000] CPU 0
[  +0.000000] Pid: 1481, comm: kworker/u:2H Not tainted 3.9.0-rc1-25019-gad82cdd #1 Bochs Bochs
[  +0.000000] RIP: 0010:[&lt;ffffffff810620dd&gt;]  [&lt;ffffffff810620dd&gt;] __lock_acquire+0xed/0xe82
[  +0.000000] RSP: 0018:ffff88003c3c19d8  EFLAGS: 00010002
[  +0.000000] RAX: 0000000000000001 RBX: 0000000000000246 RCX: 0000000000000000
[  +0.000000] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88003d1be868
[  +0.000000] RBP: ffff88003c3c1a98 R08: 0000000000000002 R09: 0000000000000000
[  +0.000000] R10: ffff88003d1be868 R11: ffff88003e20b000 R12: 0000000000000002
[  +0.000000] R13: ffff88003aaa8000 R14: 000000000000006e R15: ffff88003d1be850
[  +0.000000] FS:  0000000000000000(0000) GS:ffff88003e200000(0000) knlGS:0000000000000000
[  +0.000000] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  +0.000000] CR2: 0000000000000199 CR3: 000000003c1cb000 CR4: 00000000000006b0
[  +0.000000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  +0.000000] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  +0.000000] Process kworker/u:2H (pid: 1481, threadinfo ffff88003c3c0000, task ffff88003aaa8000)
[  +0.000000] Stack:
[  +0.000000]  ffffffff81b16342 0000000000000000 0000000000000000 ffff88003d1be868
[  +0.000000]  ffffffff00000000 00018c0c7863e367 000000003c3c1a28 ffffffff8101efbd
[  +0.000000]  0000000000000000 ffff88003e3d2400 ffff88003c3c1a38 ffffffff81007c7a
[  +0.000000] Call Trace:
[  +0.000000]  [&lt;ffffffff8101efbd&gt;] ? kvm_clock_read+0x34/0x3b
[  +0.000000]  [&lt;ffffffff81007c7a&gt;] ? paravirt_sched_clock+0x9/0xd
[  +0.000000]  [&lt;ffffffff81007fd4&gt;] ? sched_clock+0x9/0xb
[  +0.000000]  [&lt;ffffffff8104fd7a&gt;] ? sched_clock_local+0x12/0x75
[  +0.000000]  [&lt;ffffffff810632d1&gt;] lock_acquire+0x93/0xb1
[  +0.000000]  [&lt;ffffffffa0022339&gt;] ? spin_lock+0x9/0xb [bluetooth]
[  +0.000000]  [&lt;ffffffff8105f3d8&gt;] ? lock_release_holdtime.part.22+0x4e/0x55
[  +0.000000]  [&lt;ffffffff814f6038&gt;] _raw_spin_lock+0x40/0x74
[  +0.000000]  [&lt;ffffffffa0022339&gt;] ? spin_lock+0x9/0xb [bluetooth]
[  +0.000000]  [&lt;ffffffff814f6936&gt;] ? _raw_spin_unlock+0x23/0x36
[  +0.000000]  [&lt;ffffffffa0022339&gt;] spin_lock+0x9/0xb [bluetooth]
[  +0.000000]  [&lt;ffffffffa00230cc&gt;] sco_conn_del+0x76/0xbb [bluetooth]
[  +0.000000]  [&lt;ffffffffa002391d&gt;] sco_connect_cfm+0x2da/0x2e9 [bluetooth]
[  +0.000000]  [&lt;ffffffffa000862a&gt;] hci_proto_connect_cfm+0x38/0x65 [bluetooth]
[  +0.000000]  [&lt;ffffffffa0008d30&gt;] hci_sync_conn_complete_evt.isra.79+0x11a/0x13e [bluetooth]
[  +0.000000]  [&lt;ffffffffa000cd96&gt;] hci_event_packet+0x153b/0x239d [bluetooth]
[  +0.000000]  [&lt;ffffffff814f68ff&gt;] ? _raw_spin_unlock_irqrestore+0x48/0x5c
[  +0.000000]  [&lt;ffffffffa00025f6&gt;] hci_rx_work+0xf3/0x2e3 [bluetooth]
[  +0.000000]  [&lt;ffffffff8103efed&gt;] process_one_work+0x1dc/0x30b
[  +0.000000]  [&lt;ffffffff8103ef83&gt;] ? process_one_work+0x172/0x30b
[  +0.000000]  [&lt;ffffffff8103e07f&gt;] ? spin_lock_irq+0x9/0xb
[  +0.000000]  [&lt;ffffffff8103fc8d&gt;] worker_thread+0x123/0x1d2
[  +0.000000]  [&lt;ffffffff8103fb6a&gt;] ? manage_workers+0x240/0x240
[  +0.000000]  [&lt;ffffffff81044211&gt;] kthread+0x9d/0xa5
[  +0.000000]  [&lt;ffffffff81044174&gt;] ? __kthread_parkme+0x60/0x60
[  +0.000000]  [&lt;ffffffff814f75bc&gt;] ret_from_fork+0x7c/0xb0
[  +0.000000]  [&lt;ffffffff81044174&gt;] ? __kthread_parkme+0x60/0x60
[  +0.000000] Code: d7 44 89 8d 50 ff ff ff 4c 89 95 58 ff ff ff e8 44 fc ff ff 44 8b 8d 50 ff ff ff 48 85 c0 4c 8b 95 58 ff ff ff 0f 84 7a 04 00 00 &lt;f0&gt; ff 80 98 01 00 00 83 3d 25 41 a7 00 00 45 8b b5 e8 05 00 00
[  +0.000000] RIP  [&lt;ffffffff810620dd&gt;] __lock_acquire+0xed/0xe82
[  +0.000000]  RSP &lt;ffff88003c3c19d8&gt;
[  +0.000000] CR2: 0000000000000199
[  +0.000000] ---[ end trace e73cd3b52352dd34 ]---

Cc: stable@vger.kernel.org [3.8]
Signed-off-by: Vinicius Costa Gomes &lt;vinicius.gomes@openbossa.org&gt;
Tested-by: Frederic Dalleau &lt;frederic.dalleau@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hlist: drop the node parameter from iterators</title>
<updated>2013-02-28T03:10:24+00:00</updated>
<author>
<name>Sasha Levin</name>
<email>sasha.levin@oracle.com</email>
</author>
<published>2013-02-28T01:06:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b67bfe0d42cac56c512dd5da4b1b347a23f4b70a'/>
<id>b67bfe0d42cac56c512dd5da4b1b347a23f4b70a</id>
<content type='text'>
I'm not sure why, but the hlist for each entry iterators were conceived

        list_for_each_entry(pos, head, member)

The hlist ones were greedy and wanted an extra parameter:

        hlist_for_each_entry(tpos, pos, head, member)

Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.

Besides the semantic patch, there was some manual work required:

 - Fix up the actual hlist iterators in linux/list.h
 - Fix up the declaration of other iterators based on the hlist ones.
 - A very small amount of places were using the 'node' parameter, this
 was modified to use 'obj-&gt;member' instead.
 - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
 properly, so those had to be fixed up manually.

The semantic patch which is mostly the work of Peter Senna Tschudin is here:

@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

type T;
expression a,c,d,e;
identifier b;
statement S;
@@

-T b;
    &lt;+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
    ...+&gt;

[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin &lt;peter.senna@gmail.com&gt;
Acked-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Cc: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
Cc: Gleb Natapov &lt;gleb@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I'm not sure why, but the hlist for each entry iterators were conceived

        list_for_each_entry(pos, head, member)

The hlist ones were greedy and wanted an extra parameter:

        hlist_for_each_entry(tpos, pos, head, member)

Why did they need an extra pos parameter? I'm not quite sure. Not only
they don't really need it, it also prevents the iterator from looking
exactly like the list iterator, which is unfortunate.

Besides the semantic patch, there was some manual work required:

 - Fix up the actual hlist iterators in linux/list.h
 - Fix up the declaration of other iterators based on the hlist ones.
 - A very small amount of places were using the 'node' parameter, this
 was modified to use 'obj-&gt;member' instead.
 - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
 properly, so those had to be fixed up manually.

The semantic patch which is mostly the work of Peter Senna Tschudin is here:

@@
iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

type T;
expression a,c,d,e;
identifier b;
statement S;
@@

-T b;
    &lt;+... when != b
(
hlist_for_each_entry(a,
- b,
c, d) S
|
hlist_for_each_entry_continue(a,
- b,
c) S
|
hlist_for_each_entry_from(a,
- b,
c) S
|
hlist_for_each_entry_rcu(a,
- b,
c, d) S
|
hlist_for_each_entry_rcu_bh(a,
- b,
c, d) S
|
hlist_for_each_entry_continue_rcu_bh(a,
- b,
c) S
|
for_each_busy_worker(a, c,
- b,
d) S
|
ax25_uid_for_each(a,
- b,
c) S
|
ax25_for_each(a,
- b,
c) S
|
inet_bind_bucket_for_each(a,
- b,
c) S
|
sctp_for_each_hentry(a,
- b,
c) S
|
sk_for_each(a,
- b,
c) S
|
sk_for_each_rcu(a,
- b,
c) S
|
sk_for_each_from
-(a, b)
+(a)
S
+ sk_for_each_from(a) S
|
sk_for_each_safe(a,
- b,
c, d) S
|
sk_for_each_bound(a,
- b,
c) S
|
hlist_for_each_entry_safe(a,
- b,
c, d, e) S
|
hlist_for_each_entry_continue_rcu(a,
- b,
c) S
|
nr_neigh_for_each(a,
- b,
c) S
|
nr_neigh_for_each_safe(a,
- b,
c, d) S
|
nr_node_for_each(a,
- b,
c) S
|
nr_node_for_each_safe(a,
- b,
c, d) S
|
- for_each_gfn_sp(a, c, d, b) S
+ for_each_gfn_sp(a, c, d) S
|
- for_each_gfn_indirect_valid_sp(a, c, d, b) S
+ for_each_gfn_indirect_valid_sp(a, c, d) S
|
for_each_host(a,
- b,
c) S
|
for_each_host_safe(a,
- b,
c, d) S
|
for_each_mesh_entry(a,
- b,
c, d) S
)
    ...+&gt;

[akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
[akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
[akpm@linux-foundation.org: checkpatch fixes]
[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foudnation.org: redo intrusive kvm changes]
Tested-by: Peter Senna Tschudin &lt;peter.senna@gmail.com&gt;
Acked-by: Paul E. McKenney &lt;paulmck@linux.vnet.ibm.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Cc: Marcelo Tosatti &lt;mtosatti@redhat.com&gt;
Cc: Gleb Natapov &lt;gleb@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Reduce critical section in sco_conn_ready</title>
<updated>2013-02-01T17:50:18+00:00</updated>
<author>
<name>Andre Guedes</name>
<email>andre.guedes@openbossa.org</email>
</author>
<published>2013-01-29T22:59:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=405280887f8fb4e168a1bbc865917bb2b881db95'/>
<id>405280887f8fb4e168a1bbc865917bb2b881db95</id>
<content type='text'>
This patch reduces the critical section protected by sco_conn_lock in
sco_conn_ready function. The lock is acquired only when it is really
needed.

This patch fixes the following lockdep warning which is generated
when the host terminates a SCO connection.

Today, this warning is a false positive. There is no way those
two threads reported by lockdep are running at the same time since
hdev-&gt;workqueue (where rx_work is queued) is single-thread. However,
if somehow this behavior is changed in future, we will have a
potential deadlock.

======================================================
[ INFO: possible circular locking dependency detected ]
3.8.0-rc1+ #7 Not tainted
-------------------------------------------------------
kworker/u:1H/1018 is trying to acquire lock:
 (&amp;(&amp;conn-&gt;lock)-&gt;rlock){+.+...}, at: [&lt;ffffffffa0033ba6&gt;] sco_chan_del+0x66/0x190 [bluetooth]

but task is already holding lock:
 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [&lt;ffffffffa0033d5a&gt;] sco_conn_del+0x8a/0xe0 [bluetooth]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}:
       [&lt;ffffffff81083011&gt;] lock_acquire+0xb1/0xe0
       [&lt;ffffffff813efd01&gt;] _raw_spin_lock+0x41/0x80
       [&lt;ffffffffa003436e&gt;] sco_connect_cfm+0xbe/0x350 [bluetooth]
       [&lt;ffffffffa0015d6c&gt;] hci_event_packet+0xd3c/0x29b0 [bluetooth]
       [&lt;ffffffffa0004583&gt;] hci_rx_work+0x133/0x870 [bluetooth]
       [&lt;ffffffff8104d65f&gt;] process_one_work+0x2bf/0x4f0
       [&lt;ffffffff81050022&gt;] worker_thread+0x2b2/0x3e0
       [&lt;ffffffff81056021&gt;] kthread+0xd1/0xe0
       [&lt;ffffffff813f14bc&gt;] ret_from_fork+0x7c/0xb0

-&gt; #0 (&amp;(&amp;conn-&gt;lock)-&gt;rlock){+.+...}:
       [&lt;ffffffff81082215&gt;] __lock_acquire+0x1465/0x1c70
       [&lt;ffffffff81083011&gt;] lock_acquire+0xb1/0xe0
       [&lt;ffffffff813efd01&gt;] _raw_spin_lock+0x41/0x80
       [&lt;ffffffffa0033ba6&gt;] sco_chan_del+0x66/0x190 [bluetooth]
       [&lt;ffffffffa0033d6d&gt;] sco_conn_del+0x9d/0xe0 [bluetooth]
       [&lt;ffffffffa0034653&gt;] sco_disconn_cfm+0x53/0x60 [bluetooth]
       [&lt;ffffffffa000fef3&gt;] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
       [&lt;ffffffffa00150f7&gt;] hci_event_packet+0xc7/0x29b0 [bluetooth]
       [&lt;ffffffffa0004583&gt;] hci_rx_work+0x133/0x870 [bluetooth]
       [&lt;ffffffff8104d65f&gt;] process_one_work+0x2bf/0x4f0
       [&lt;ffffffff81050022&gt;] worker_thread+0x2b2/0x3e0
       [&lt;ffffffff81056021&gt;] kthread+0xd1/0xe0
       [&lt;ffffffff813f14bc&gt;] ret_from_fork+0x7c/0xb0

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
                               lock(&amp;(&amp;conn-&gt;lock)-&gt;rlock);
                               lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
  lock(&amp;(&amp;conn-&gt;lock)-&gt;rlock);

 *** DEADLOCK ***

4 locks held by kworker/u:1H/1018:
 #0:  (hdev-&gt;name#2){.+.+.+}, at: [&lt;ffffffff8104d5f8&gt;] process_one_work+0x258/0x4f0
 #1:  ((&amp;hdev-&gt;rx_work)){+.+.+.}, at: [&lt;ffffffff8104d5f8&gt;] process_one_work+0x258/0x4f0
 #2:  (&amp;hdev-&gt;lock){+.+.+.}, at: [&lt;ffffffffa000fbe9&gt;] hci_disconn_complete_evt.isra.54+0x59/0x3c0 [bluetooth]
 #3:  (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [&lt;ffffffffa0033d5a&gt;] sco_conn_del+0x8a/0xe0 [bluetooth]

stack backtrace:
Pid: 1018, comm: kworker/u:1H Not tainted 3.8.0-rc1+ #7
Call Trace:
 [&lt;ffffffff813e92f9&gt;] print_circular_bug+0x1fb/0x20c
 [&lt;ffffffff81082215&gt;] __lock_acquire+0x1465/0x1c70
 [&lt;ffffffff81083011&gt;] lock_acquire+0xb1/0xe0
 [&lt;ffffffffa0033ba6&gt;] ? sco_chan_del+0x66/0x190 [bluetooth]
 [&lt;ffffffff813efd01&gt;] _raw_spin_lock+0x41/0x80
 [&lt;ffffffffa0033ba6&gt;] ? sco_chan_del+0x66/0x190 [bluetooth]
 [&lt;ffffffffa0033ba6&gt;] sco_chan_del+0x66/0x190 [bluetooth]
 [&lt;ffffffffa0033d6d&gt;] sco_conn_del+0x9d/0xe0 [bluetooth]
 [&lt;ffffffffa0034653&gt;] sco_disconn_cfm+0x53/0x60 [bluetooth]
 [&lt;ffffffffa000fef3&gt;] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
 [&lt;ffffffffa000fbd0&gt;] ? hci_disconn_complete_evt.isra.54+0x40/0x3c0 [bluetooth]
 [&lt;ffffffffa00150f7&gt;] hci_event_packet+0xc7/0x29b0 [bluetooth]
 [&lt;ffffffff81202e90&gt;] ? __dynamic_pr_debug+0x80/0x90
 [&lt;ffffffff8133ff7d&gt;] ? kfree_skb+0x2d/0x40
 [&lt;ffffffffa0021644&gt;] ? hci_send_to_monitor+0x1a4/0x1c0 [bluetooth]
 [&lt;ffffffffa0004583&gt;] hci_rx_work+0x133/0x870 [bluetooth]
 [&lt;ffffffff8104d5f8&gt;] ? process_one_work+0x258/0x4f0
 [&lt;ffffffff8104d65f&gt;] process_one_work+0x2bf/0x4f0
 [&lt;ffffffff8104d5f8&gt;] ? process_one_work+0x258/0x4f0
 [&lt;ffffffff8104fdc1&gt;] ? worker_thread+0x51/0x3e0
 [&lt;ffffffffa0004450&gt;] ? hci_tx_work+0x800/0x800 [bluetooth]
 [&lt;ffffffff81050022&gt;] worker_thread+0x2b2/0x3e0
 [&lt;ffffffff8104fd70&gt;] ? busy_worker_rebind_fn+0x100/0x100
 [&lt;ffffffff81056021&gt;] kthread+0xd1/0xe0
 [&lt;ffffffff81055f50&gt;] ? flush_kthread_worker+0xc0/0xc0
 [&lt;ffffffff813f14bc&gt;] ret_from_fork+0x7c/0xb0
 [&lt;ffffffff81055f50&gt;] ? flush_kthread_worker+0xc0/0xc0

Signed-off-by: Andre Guedes &lt;andre.guedes@openbossa.org&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch reduces the critical section protected by sco_conn_lock in
sco_conn_ready function. The lock is acquired only when it is really
needed.

This patch fixes the following lockdep warning which is generated
when the host terminates a SCO connection.

Today, this warning is a false positive. There is no way those
two threads reported by lockdep are running at the same time since
hdev-&gt;workqueue (where rx_work is queued) is single-thread. However,
if somehow this behavior is changed in future, we will have a
potential deadlock.

======================================================
[ INFO: possible circular locking dependency detected ]
3.8.0-rc1+ #7 Not tainted
-------------------------------------------------------
kworker/u:1H/1018 is trying to acquire lock:
 (&amp;(&amp;conn-&gt;lock)-&gt;rlock){+.+...}, at: [&lt;ffffffffa0033ba6&gt;] sco_chan_del+0x66/0x190 [bluetooth]

but task is already holding lock:
 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [&lt;ffffffffa0033d5a&gt;] sco_conn_del+0x8a/0xe0 [bluetooth]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #1 (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}:
       [&lt;ffffffff81083011&gt;] lock_acquire+0xb1/0xe0
       [&lt;ffffffff813efd01&gt;] _raw_spin_lock+0x41/0x80
       [&lt;ffffffffa003436e&gt;] sco_connect_cfm+0xbe/0x350 [bluetooth]
       [&lt;ffffffffa0015d6c&gt;] hci_event_packet+0xd3c/0x29b0 [bluetooth]
       [&lt;ffffffffa0004583&gt;] hci_rx_work+0x133/0x870 [bluetooth]
       [&lt;ffffffff8104d65f&gt;] process_one_work+0x2bf/0x4f0
       [&lt;ffffffff81050022&gt;] worker_thread+0x2b2/0x3e0
       [&lt;ffffffff81056021&gt;] kthread+0xd1/0xe0
       [&lt;ffffffff813f14bc&gt;] ret_from_fork+0x7c/0xb0

-&gt; #0 (&amp;(&amp;conn-&gt;lock)-&gt;rlock){+.+...}:
       [&lt;ffffffff81082215&gt;] __lock_acquire+0x1465/0x1c70
       [&lt;ffffffff81083011&gt;] lock_acquire+0xb1/0xe0
       [&lt;ffffffff813efd01&gt;] _raw_spin_lock+0x41/0x80
       [&lt;ffffffffa0033ba6&gt;] sco_chan_del+0x66/0x190 [bluetooth]
       [&lt;ffffffffa0033d6d&gt;] sco_conn_del+0x9d/0xe0 [bluetooth]
       [&lt;ffffffffa0034653&gt;] sco_disconn_cfm+0x53/0x60 [bluetooth]
       [&lt;ffffffffa000fef3&gt;] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
       [&lt;ffffffffa00150f7&gt;] hci_event_packet+0xc7/0x29b0 [bluetooth]
       [&lt;ffffffffa0004583&gt;] hci_rx_work+0x133/0x870 [bluetooth]
       [&lt;ffffffff8104d65f&gt;] process_one_work+0x2bf/0x4f0
       [&lt;ffffffff81050022&gt;] worker_thread+0x2b2/0x3e0
       [&lt;ffffffff81056021&gt;] kthread+0xd1/0xe0
       [&lt;ffffffff813f14bc&gt;] ret_from_fork+0x7c/0xb0

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
                               lock(&amp;(&amp;conn-&gt;lock)-&gt;rlock);
                               lock(slock-AF_BLUETOOTH-BTPROTO_SCO);
  lock(&amp;(&amp;conn-&gt;lock)-&gt;rlock);

 *** DEADLOCK ***

4 locks held by kworker/u:1H/1018:
 #0:  (hdev-&gt;name#2){.+.+.+}, at: [&lt;ffffffff8104d5f8&gt;] process_one_work+0x258/0x4f0
 #1:  ((&amp;hdev-&gt;rx_work)){+.+.+.}, at: [&lt;ffffffff8104d5f8&gt;] process_one_work+0x258/0x4f0
 #2:  (&amp;hdev-&gt;lock){+.+.+.}, at: [&lt;ffffffffa000fbe9&gt;] hci_disconn_complete_evt.isra.54+0x59/0x3c0 [bluetooth]
 #3:  (slock-AF_BLUETOOTH-BTPROTO_SCO){+.+...}, at: [&lt;ffffffffa0033d5a&gt;] sco_conn_del+0x8a/0xe0 [bluetooth]

stack backtrace:
Pid: 1018, comm: kworker/u:1H Not tainted 3.8.0-rc1+ #7
Call Trace:
 [&lt;ffffffff813e92f9&gt;] print_circular_bug+0x1fb/0x20c
 [&lt;ffffffff81082215&gt;] __lock_acquire+0x1465/0x1c70
 [&lt;ffffffff81083011&gt;] lock_acquire+0xb1/0xe0
 [&lt;ffffffffa0033ba6&gt;] ? sco_chan_del+0x66/0x190 [bluetooth]
 [&lt;ffffffff813efd01&gt;] _raw_spin_lock+0x41/0x80
 [&lt;ffffffffa0033ba6&gt;] ? sco_chan_del+0x66/0x190 [bluetooth]
 [&lt;ffffffffa0033ba6&gt;] sco_chan_del+0x66/0x190 [bluetooth]
 [&lt;ffffffffa0033d6d&gt;] sco_conn_del+0x9d/0xe0 [bluetooth]
 [&lt;ffffffffa0034653&gt;] sco_disconn_cfm+0x53/0x60 [bluetooth]
 [&lt;ffffffffa000fef3&gt;] hci_disconn_complete_evt.isra.54+0x363/0x3c0 [bluetooth]
 [&lt;ffffffffa000fbd0&gt;] ? hci_disconn_complete_evt.isra.54+0x40/0x3c0 [bluetooth]
 [&lt;ffffffffa00150f7&gt;] hci_event_packet+0xc7/0x29b0 [bluetooth]
 [&lt;ffffffff81202e90&gt;] ? __dynamic_pr_debug+0x80/0x90
 [&lt;ffffffff8133ff7d&gt;] ? kfree_skb+0x2d/0x40
 [&lt;ffffffffa0021644&gt;] ? hci_send_to_monitor+0x1a4/0x1c0 [bluetooth]
 [&lt;ffffffffa0004583&gt;] hci_rx_work+0x133/0x870 [bluetooth]
 [&lt;ffffffff8104d5f8&gt;] ? process_one_work+0x258/0x4f0
 [&lt;ffffffff8104d65f&gt;] process_one_work+0x2bf/0x4f0
 [&lt;ffffffff8104d5f8&gt;] ? process_one_work+0x258/0x4f0
 [&lt;ffffffff8104fdc1&gt;] ? worker_thread+0x51/0x3e0
 [&lt;ffffffffa0004450&gt;] ? hci_tx_work+0x800/0x800 [bluetooth]
 [&lt;ffffffff81050022&gt;] worker_thread+0x2b2/0x3e0
 [&lt;ffffffff8104fd70&gt;] ? busy_worker_rebind_fn+0x100/0x100
 [&lt;ffffffff81056021&gt;] kthread+0xd1/0xe0
 [&lt;ffffffff81055f50&gt;] ? flush_kthread_worker+0xc0/0xc0
 [&lt;ffffffff813f14bc&gt;] ret_from_fork+0x7c/0xb0
 [&lt;ffffffff81055f50&gt;] ? flush_kthread_worker+0xc0/0xc0

Signed-off-by: Andre Guedes &lt;andre.guedes@openbossa.org&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Check if the hci connection exists in SCO shutdown</title>
<updated>2013-01-10T05:53:32+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo.padovan@collabora.co.uk</email>
</author>
<published>2013-01-03T21:59:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b7e98b5100aad9290d7f06fcb9d1e80f7f62f05f'/>
<id>b7e98b5100aad9290d7f06fcb9d1e80f7f62f05f</id>
<content type='text'>
Checking only for sco_conn seems to not be enough and lead to NULL
dereferences in the code, check for hcon instead.

&lt;1&gt;[11340.226404] BUG: unable to handle kernel NULL pointer dereference at
0000000
8
&lt;4&gt;[11340.226619] EIP is at __sco_sock_close+0xe8/0x1a0
&lt;4&gt;[11340.226629] EAX: f063a740 EBX: 00000000 ECX: f58f4544 EDX: 00000000
&lt;4&gt;[11340.226640] ESI: dec83e00 EDI: 5f9a081f EBP: e0fdff38 ESP: e0fdff1c
&lt;0&gt;[11340.226674] Stack:
&lt;4&gt;[11340.226682]  c184db87 c1251028 dec83e00 e0fdff38 c1754aef dec83e00
00000000
e0fdff5c
&lt;4&gt;[11340.226718]  c184f587 e0fdff64 e0fdff68 5f9a081f e0fdff5c c1751852
d7813800
62262f10
&lt;4&gt;[11340.226752]  e0fdff70 c1753c00 00000000 00000001 0000000d e0fdffac
c175425c
00000041
&lt;0&gt;[11340.226793] Call Trace:
&lt;4&gt;[11340.226813]  [&lt;c184db87&gt;] ? sco_sock_clear_timer+0x27/0x60
&lt;4&gt;[11340.226831]  [&lt;c1251028&gt;] ? local_bh_enable+0x68/0xd0
&lt;4&gt;[11340.226846]  [&lt;c1754aef&gt;] ? lock_sock_nested+0x4f/0x60
&lt;4&gt;[11340.226862]  [&lt;c184f587&gt;] sco_sock_shutdown+0x67/0xb0
&lt;4&gt;[11340.226879]  [&lt;c1751852&gt;] ? sockfd_lookup_light+0x22/0x80
&lt;4&gt;[11340.226897]  [&lt;c1753c00&gt;] sys_shutdown+0x30/0x60
&lt;4&gt;[11340.226912]  [&lt;c175425c&gt;] sys_socketcall+0x1dc/0x2a0
&lt;4&gt;[11340.226929]  [&lt;c149ba78&gt;] ? trace_hardirqs_on_thunk+0xc/0x10
&lt;4&gt;[11340.226944]  [&lt;c18860f1&gt;] syscall_call+0x7/0xb
&lt;4&gt;[11340.226960]  [&lt;c1880000&gt;] ? restore_cur+0x5e/0xd7
&lt;0&gt;[11340.226969] Code: &lt;f0&gt; ff 4b 08 0f 94 c0 84 c0 74 20 80 7b 19 01 74
2f b8 0a 00 00

Reported-by: Chuansheng Liu &lt;chuansheng.liu@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Checking only for sco_conn seems to not be enough and lead to NULL
dereferences in the code, check for hcon instead.

&lt;1&gt;[11340.226404] BUG: unable to handle kernel NULL pointer dereference at
0000000
8
&lt;4&gt;[11340.226619] EIP is at __sco_sock_close+0xe8/0x1a0
&lt;4&gt;[11340.226629] EAX: f063a740 EBX: 00000000 ECX: f58f4544 EDX: 00000000
&lt;4&gt;[11340.226640] ESI: dec83e00 EDI: 5f9a081f EBP: e0fdff38 ESP: e0fdff1c
&lt;0&gt;[11340.226674] Stack:
&lt;4&gt;[11340.226682]  c184db87 c1251028 dec83e00 e0fdff38 c1754aef dec83e00
00000000
e0fdff5c
&lt;4&gt;[11340.226718]  c184f587 e0fdff64 e0fdff68 5f9a081f e0fdff5c c1751852
d7813800
62262f10
&lt;4&gt;[11340.226752]  e0fdff70 c1753c00 00000000 00000001 0000000d e0fdffac
c175425c
00000041
&lt;0&gt;[11340.226793] Call Trace:
&lt;4&gt;[11340.226813]  [&lt;c184db87&gt;] ? sco_sock_clear_timer+0x27/0x60
&lt;4&gt;[11340.226831]  [&lt;c1251028&gt;] ? local_bh_enable+0x68/0xd0
&lt;4&gt;[11340.226846]  [&lt;c1754aef&gt;] ? lock_sock_nested+0x4f/0x60
&lt;4&gt;[11340.226862]  [&lt;c184f587&gt;] sco_sock_shutdown+0x67/0xb0
&lt;4&gt;[11340.226879]  [&lt;c1751852&gt;] ? sockfd_lookup_light+0x22/0x80
&lt;4&gt;[11340.226897]  [&lt;c1753c00&gt;] sys_shutdown+0x30/0x60
&lt;4&gt;[11340.226912]  [&lt;c175425c&gt;] sys_socketcall+0x1dc/0x2a0
&lt;4&gt;[11340.226929]  [&lt;c149ba78&gt;] ? trace_hardirqs_on_thunk+0xc/0x10
&lt;4&gt;[11340.226944]  [&lt;c18860f1&gt;] syscall_call+0x7/0xb
&lt;4&gt;[11340.226960]  [&lt;c1880000&gt;] ? restore_cur+0x5e/0xd7
&lt;0&gt;[11340.226969] Code: &lt;f0&gt; ff 4b 08 0f 94 c0 84 c0 74 20 80 7b 19 01 74
2f b8 0a 00 00

Reported-by: Chuansheng Liu &lt;chuansheng.liu@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Bluetooth: Fix possible deadlock in SCO code"</title>
<updated>2012-12-03T18:00:04+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo.padovan@collabora.co.uk</email>
</author>
<published>2012-12-03T17:36:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0b27a4b97cb1874503c78453c0903df53c0c86b2'/>
<id>0b27a4b97cb1874503c78453c0903df53c0c86b2</id>
<content type='text'>
This reverts commit 269c4845d5b3627b95b1934107251bacbe99bb68.

The commit was causing dead locks and NULL dereferences in the sco code:

 [28084.104013] BUG: soft lockup - CPU#0 stuck for 22s! [kworker/u:0H:7]
 [28084.104021] Modules linked in: btusb bluetooth &lt;snip [last unloaded:
bluetooth]
...
 [28084.104021]  [&lt;c160246d&gt;] _raw_spin_lock+0xd/0x10
 [28084.104021]  [&lt;f920e708&gt;] sco_conn_del+0x58/0x1b0 [bluetooth]
 [28084.104021]  [&lt;f920f1a9&gt;] sco_connect_cfm+0xb9/0x2b0 [bluetooth]
 [28084.104021]  [&lt;f91ef289&gt;]
hci_sync_conn_complete_evt.isra.94+0x1c9/0x260 [bluetooth]
 [28084.104021]  [&lt;f91f1a8d&gt;] hci_event_packet+0x74d/0x2b40 [bluetooth]
 [28084.104021]  [&lt;c1501abd&gt;] ? __kfree_skb+0x3d/0x90
 [28084.104021]  [&lt;c1501b46&gt;] ? kfree_skb+0x36/0x90
 [28084.104021]  [&lt;f91fcb4e&gt;] ? hci_send_to_monitor+0x10e/0x190 [bluetooth]
 [28084.104021]  [&lt;f91fcb4e&gt;] ? hci_send_to_monitor+0x10e/0x190 [bluetooth]

Cc: stable@vger.kernel.org
Reported-by: Chan-yeol Park &lt;chanyeol.park@gmail.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 269c4845d5b3627b95b1934107251bacbe99bb68.

The commit was causing dead locks and NULL dereferences in the sco code:

 [28084.104013] BUG: soft lockup - CPU#0 stuck for 22s! [kworker/u:0H:7]
 [28084.104021] Modules linked in: btusb bluetooth &lt;snip [last unloaded:
bluetooth]
...
 [28084.104021]  [&lt;c160246d&gt;] _raw_spin_lock+0xd/0x10
 [28084.104021]  [&lt;f920e708&gt;] sco_conn_del+0x58/0x1b0 [bluetooth]
 [28084.104021]  [&lt;f920f1a9&gt;] sco_connect_cfm+0xb9/0x2b0 [bluetooth]
 [28084.104021]  [&lt;f91ef289&gt;]
hci_sync_conn_complete_evt.isra.94+0x1c9/0x260 [bluetooth]
 [28084.104021]  [&lt;f91f1a8d&gt;] hci_event_packet+0x74d/0x2b40 [bluetooth]
 [28084.104021]  [&lt;c1501abd&gt;] ? __kfree_skb+0x3d/0x90
 [28084.104021]  [&lt;c1501b46&gt;] ? kfree_skb+0x36/0x90
 [28084.104021]  [&lt;f91fcb4e&gt;] ? hci_send_to_monitor+0x10e/0x190 [bluetooth]
 [28084.104021]  [&lt;f91fcb4e&gt;] ? hci_send_to_monitor+0x10e/0x190 [bluetooth]

Cc: stable@vger.kernel.org
Reported-by: Chan-yeol Park &lt;chanyeol.park@gmail.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Implement deferred sco socket setup</title>
<updated>2012-12-03T17:59:58+00:00</updated>
<author>
<name>Frédéric Dalleau</name>
<email>frederic.dalleau@linux.intel.com</email>
</author>
<published>2012-11-21T09:51:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=20714bfef84d3e690c9c6f8e9cd46543b5ae1eed'/>
<id>20714bfef84d3e690c9c6f8e9cd46543b5ae1eed</id>
<content type='text'>
In order to authenticate and configure an incoming SCO connection, the
BT_DEFER_SETUP option was added. This option is intended to defer reply
to Connect Request on SCO sockets.
When a connection is requested, the listening socket is unblocked but
the effective connection setup happens only on first recv. Any send
between accept and recv fails with -ENOTCONN.

Signed-off-by: Frédéric Dalleau &lt;frederic.dalleau@linux.intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to authenticate and configure an incoming SCO connection, the
BT_DEFER_SETUP option was added. This option is intended to defer reply
to Connect Request on SCO sockets.
When a connection is requested, the listening socket is unblocked but
the effective connection setup happens only on first recv. Any send
between accept and recv fails with -ENOTCONN.

Signed-off-by: Frédéric Dalleau &lt;frederic.dalleau@linux.intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Add BT_DEFER_SETUP option to sco socket</title>
<updated>2012-12-03T17:59:58+00:00</updated>
<author>
<name>Frédéric Dalleau</name>
<email>frederic.dalleau@linux.intel.com</email>
</author>
<published>2012-11-21T09:51:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b96e9c671b05f95126753a22145d4509d45ca197'/>
<id>b96e9c671b05f95126753a22145d4509d45ca197</id>
<content type='text'>
This option will set the BT_SK_DEFER_SETUP bit in socket flags.

Signed-off-by: Frédéric Dalleau &lt;frederic.dalleau@linux.intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This option will set the BT_SK_DEFER_SETUP bit in socket flags.

Signed-off-by: Frédéric Dalleau &lt;frederic.dalleau@linux.intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Use %pMR in sprintf/seq_printf instead of batostr</title>
<updated>2012-09-27T21:10:15+00:00</updated>
<author>
<name>Andrei Emeltchenko</name>
<email>andrei.emeltchenko@intel.com</email>
</author>
<published>2012-09-25T09:49:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fcb73338ed531dcc00cb17ca76fe3e05f774e4e9'/>
<id>fcb73338ed531dcc00cb17ca76fe3e05f774e4e9</id>
<content type='text'>
Instead of old unsafe batostr function use %pMR print specifier
for printing Bluetooth addresses in sprintf and seq_printf
statements.

Signed-off-by: Andrei Emeltchenko &lt;andrei.emeltchenko@intel.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of old unsafe batostr function use %pMR print specifier
for printing Bluetooth addresses in sprintf and seq_printf
statements.

Signed-off-by: Andrei Emeltchenko &lt;andrei.emeltchenko@intel.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
