<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/net/bluetooth/l2cap.c, branch v2.6.37</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Bluetooth: fix endianness conversion in L2CAP</title>
<updated>2010-11-09T02:56:09+00:00</updated>
<author>
<name>Gustavo F. Padovan</name>
<email>padovan@profusion.mobi</email>
</author>
<published>2010-10-18T16:25:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4f8b691c9fb02e72359e71592098c1de3b8ec712'/>
<id>4f8b691c9fb02e72359e71592098c1de3b8ec712</id>
<content type='text'>
Last commit added a wrong endianness conversion. Fixing that.

Reported-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Last commit added a wrong endianness conversion. Fixing that.

Reported-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: fix unaligned access to l2cap conf data</title>
<updated>2010-11-09T02:56:00+00:00</updated>
<author>
<name>steven miao</name>
<email>realmz6@gmail.com</email>
</author>
<published>2010-10-16T22:29:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bfaaeb3ed5533a2dd38e3aa9ea43efd619690aed'/>
<id>bfaaeb3ed5533a2dd38e3aa9ea43efd619690aed</id>
<content type='text'>
In function l2cap_get_conf_opt() and l2cap_add_conf_opt() the address of
opt-&gt;val sometimes is not at the edge of 2-bytes/4-bytes, so 2-bytes/4 bytes
access will cause data misalignment exeception.  Use get_unaligned_le16/32
and put_unaligned_le16/32 function to avoid data misalignment execption.

Signed-off-by: steven miao &lt;realmz6@gmail.com&gt;
Signed-off-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In function l2cap_get_conf_opt() and l2cap_add_conf_opt() the address of
opt-&gt;val sometimes is not at the edge of 2-bytes/4-bytes, so 2-bytes/4 bytes
access will cause data misalignment exeception.  Use get_unaligned_le16/32
and put_unaligned_le16/32 function to avoid data misalignment execption.

Signed-off-by: steven miao &lt;realmz6@gmail.com&gt;
Signed-off-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6</title>
<updated>2010-10-21T15:43:05+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2010-10-21T15:43:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2198a10b501fd4443430cb17e065a9e859cc58c9'/>
<id>2198a10b501fd4443430cb17e065a9e859cc58c9</id>
<content type='text'>
Conflicts:
	net/core/dev.c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	net/core/dev.c
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: fix oops in l2cap_connect_req</title>
<updated>2010-10-17T23:19:19+00:00</updated>
<author>
<name>Nathan Holstein</name>
<email>nathan.holstein@gmail.com</email>
</author>
<published>2010-10-15T15:54:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d793fe8caa3911e6a1e826b45d4ee00d250cdec8'/>
<id>d793fe8caa3911e6a1e826b45d4ee00d250cdec8</id>
<content type='text'>
In error cases when the ACL is insecure or we fail to allocate a new
struct sock, we jump to the "response" label.  If so, "sk" will be
null and the kernel crashes.

Signed-off-by: Nathan Holstein &lt;nathan.holstein@gmail.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In error cases when the ACL is insecure or we fail to allocate a new
struct sock, we jump to the "response" label.  If so, "sk" will be
null and the kernel crashes.

Signed-off-by: Nathan Holstein &lt;nathan.holstein@gmail.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Update conf_state before send config_req out</title>
<updated>2010-10-12T15:44:53+00:00</updated>
<author>
<name>Haijun Liu</name>
<email>haijun.liu@atheros.com</email>
</author>
<published>2010-09-30T08:52:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=ab3e571564a5d8fa4923e2e858e574c931a014c7'/>
<id>ab3e571564a5d8fa4923e2e858e574c931a014c7</id>
<content type='text'>
Update conf_state with L2CAP_CONF_REQ_SENT before send config_req out in
l2cap_config_req().

Signed-off-by: Haijun Liu &lt;haijun.liu@atheros.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Update conf_state with L2CAP_CONF_REQ_SENT before send config_req out in
l2cap_config_req().

Signed-off-by: Haijun Liu &lt;haijun.liu@atheros.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Use the proper error value from bt_skb_send_alloc()</title>
<updated>2010-10-12T15:44:52+00:00</updated>
<author>
<name>Gustavo F. Padovan</name>
<email>padovan@profusion.mobi</email>
</author>
<published>2010-09-24T23:30:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0175d629e096a5a59dde6cc91b32ac3160a44b9e'/>
<id>0175d629e096a5a59dde6cc91b32ac3160a44b9e</id>
<content type='text'>
&amp;err points to the proper error set by bt_skb_send_alloc() when it
fails.

Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
&amp;err points to the proper error set by bt_skb_send_alloc() when it
fails.

Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: check for l2cap header in start fragment</title>
<updated>2010-10-12T15:44:52+00:00</updated>
<author>
<name>Andrei Emeltchenko</name>
<email>andrei.emeltchenko@nokia.com</email>
</author>
<published>2010-09-15T11:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=aae7fe22a875a84e328469e228cba033ebbf20cb'/>
<id>aae7fe22a875a84e328469e228cba033ebbf20cb</id>
<content type='text'>
BLUETOOTH SPECIFICATION Version 4.0 [Vol 3] page 36 mentioned
"Note: Start Fragments always begin with the Basic L2CAP header
of a PDU."

Signed-off-by: Andrei Emeltchenko &lt;andrei.emeltchenko@nokia.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BLUETOOTH SPECIFICATION Version 4.0 [Vol 3] page 36 mentioned
"Note: Start Fragments always begin with the Basic L2CAP header
of a PDU."

Signed-off-by: Andrei Emeltchenko &lt;andrei.emeltchenko@nokia.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: check L2CAP length in first ACL fragment</title>
<updated>2010-10-12T15:44:52+00:00</updated>
<author>
<name>Andrei Emeltchenko</name>
<email>andrei.emeltchenko@nokia.com</email>
</author>
<published>2010-09-15T11:28:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=8979481328dc2e14cea9f99b3562ffcf8655998e'/>
<id>8979481328dc2e14cea9f99b3562ffcf8655998e</id>
<content type='text'>
Current Bluetooth code assembles fragments of big L2CAP packets
in l2cap_recv_acldata and then checks allowed L2CAP size in
assemled L2CAP packet (pi-&gt;imtu &lt; skb-&gt;len).

The patch moves allowed L2CAP size check to the early stage when
we receive the first fragment of L2CAP packet. We do not need to
reserve and keep L2CAP fragments for bad packets.

Updated version after comments from Mat Martineau &lt;mathewm@codeaurora.org&gt;
and Gustavo Padovan &lt;padovan@profusion.mobi&gt;.

Trace below is received when using stress tools sending big
fragmented L2CAP packets.
...
[ 1712.798492] swapper: page allocation failure. order:4, mode:0x4020
[ 1712.804809] [&lt;c0031870&gt;] (unwind_backtrace+0x0/0xdc) from [&lt;c00a1f70&gt;]
(__alloc_pages_nodemask+0x4)
[ 1712.814666] [&lt;c00a1f70&gt;] (__alloc_pages_nodemask+0x47c/0x4d4) from
[&lt;c00a1fd8&gt;] (__get_free_pages+)
[ 1712.824645] [&lt;c00a1fd8&gt;] (__get_free_pages+0x10/0x3c) from [&lt;c026eb5c&gt;]
(__alloc_skb+0x4c/0xfc)
[ 1712.833465] [&lt;c026eb5c&gt;] (__alloc_skb+0x4c/0xfc) from [&lt;bf28c738&gt;]
(l2cap_recv_acldata+0xf0/0x1f8 )
[ 1712.843322] [&lt;bf28c738&gt;] (l2cap_recv_acldata+0xf0/0x1f8 [l2cap]) from
[&lt;bf0094ac&gt;] (hci_rx_task+0x)
...

Signed-off-by: Andrei Emeltchenko &lt;andrei.emeltchenko@nokia.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Current Bluetooth code assembles fragments of big L2CAP packets
in l2cap_recv_acldata and then checks allowed L2CAP size in
assemled L2CAP packet (pi-&gt;imtu &lt; skb-&gt;len).

The patch moves allowed L2CAP size check to the early stage when
we receive the first fragment of L2CAP packet. We do not need to
reserve and keep L2CAP fragments for bad packets.

Updated version after comments from Mat Martineau &lt;mathewm@codeaurora.org&gt;
and Gustavo Padovan &lt;padovan@profusion.mobi&gt;.

Trace below is received when using stress tools sending big
fragmented L2CAP packets.
...
[ 1712.798492] swapper: page allocation failure. order:4, mode:0x4020
[ 1712.804809] [&lt;c0031870&gt;] (unwind_backtrace+0x0/0xdc) from [&lt;c00a1f70&gt;]
(__alloc_pages_nodemask+0x4)
[ 1712.814666] [&lt;c00a1f70&gt;] (__alloc_pages_nodemask+0x47c/0x4d4) from
[&lt;c00a1fd8&gt;] (__get_free_pages+)
[ 1712.824645] [&lt;c00a1fd8&gt;] (__get_free_pages+0x10/0x3c) from [&lt;c026eb5c&gt;]
(__alloc_skb+0x4c/0xfc)
[ 1712.833465] [&lt;c026eb5c&gt;] (__alloc_skb+0x4c/0xfc) from [&lt;bf28c738&gt;]
(l2cap_recv_acldata+0xf0/0x1f8 )
[ 1712.843322] [&lt;bf28c738&gt;] (l2cap_recv_acldata+0xf0/0x1f8 [l2cap]) from
[&lt;bf0094ac&gt;] (hci_rx_task+0x)
...

Signed-off-by: Andrei Emeltchenko &lt;andrei.emeltchenko@nokia.com&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Use a stream-oriented recvmsg with SOCK_STREAM L2CAP sockets.</title>
<updated>2010-10-12T15:44:51+00:00</updated>
<author>
<name>Mat Martineau</name>
<email>mathewm@codeaurora.org</email>
</author>
<published>2010-09-08T17:05:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6fdf482bb3298267816be59d9a3dce29632382d3'/>
<id>6fdf482bb3298267816be59d9a3dce29632382d3</id>
<content type='text'>
L2CAP ERTM sockets can be opened with the SOCK_STREAM socket type,
which is a mandatory request for ERTM mode.

However, these sockets still have SOCK_SEQPACKET read semantics when
bt_sock_recvmsg() is used to pull data from the receive queue.  If the
application is only reading part of a frame, then the unread portion
of the frame is discarded.  If the application requests more bytes
than are in the current frame, only the current frame's data is
returned.

This patch utilizes common code derived from RFCOMM's recvmsg()
function to make L2CAP SOCK_STREAM reads behave like RFCOMM reads (and
other SOCK_STREAM sockets in general).  The application may read one
byte at a time from the input stream and not lose any data, and may
also read across L2CAP frame boundaries.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
L2CAP ERTM sockets can be opened with the SOCK_STREAM socket type,
which is a mandatory request for ERTM mode.

However, these sockets still have SOCK_SEQPACKET read semantics when
bt_sock_recvmsg() is used to pull data from the receive queue.  If the
application is only reading part of a frame, then the unread portion
of the frame is discarded.  If the application requests more bytes
than are in the current frame, only the current frame's data is
returned.

This patch utilizes common code derived from RFCOMM's recvmsg()
function to make L2CAP SOCK_STREAM reads behave like RFCOMM reads (and
other SOCK_STREAM sockets in general).  The application may read one
byte at a time from the input stream and not lose any data, and may
also read across L2CAP frame boundaries.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Validate PSM values in calls to connect() and bind()</title>
<updated>2010-10-12T15:44:51+00:00</updated>
<author>
<name>Mat Martineau</name>
<email>mathewm@codeaurora.org</email>
</author>
<published>2010-09-08T17:05:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0fba2558cbb3fae3a09147b7d6e18a6204204e0e'/>
<id>0fba2558cbb3fae3a09147b7d6e18a6204204e0e</id>
<content type='text'>
Valid L2CAP PSMs are odd numbers, and the least significant bit of the
most significant byte must be 0.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Valid L2CAP PSMs are odd numbers, and the least significant bit of the
most significant byte must be 0.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Acked-by: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Signed-off-by: Gustavo F. Padovan &lt;padovan@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
</feed>
