<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/net/bluetooth/l2cap_core.c, branch v3.5</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Bluetooth: Fix using uninitialized option in RFCMode</title>
<updated>2012-06-12T02:50:28+00:00</updated>
<author>
<name>Szymon Janc</name>
<email>szymon.janc@tieto.com</email>
</author>
<published>2012-06-08T09:33:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=8f321f853ea33330c7141977cd34804476e2e07e'/>
<id>8f321f853ea33330c7141977cd34804476e2e07e</id>
<content type='text'>
If remote device sends bogus RFC option with invalid length,
undefined options values are used. Fix this by using defaults when
remote misbehaves.

This also fixes the following warning reported by gcc 4.7.0:

net/bluetooth/l2cap_core.c: In function 'l2cap_config_rsp':
net/bluetooth/l2cap_core.c:3302:13: warning: 'rfc.max_pdu_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.max_pdu_size' was declared here
net/bluetooth/l2cap_core.c:3298:25: warning: 'rfc.monitor_timeout' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.monitor_timeout' was declared here
net/bluetooth/l2cap_core.c:3297:25: warning: 'rfc.retrans_timeout' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.retrans_timeout' was declared here
net/bluetooth/l2cap_core.c:3295:2: warning: 'rfc.mode' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.mode' was declared here

Signed-off-by: Szymon Janc &lt;szymon.janc@tieto.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>
If remote device sends bogus RFC option with invalid length,
undefined options values are used. Fix this by using defaults when
remote misbehaves.

This also fixes the following warning reported by gcc 4.7.0:

net/bluetooth/l2cap_core.c: In function 'l2cap_config_rsp':
net/bluetooth/l2cap_core.c:3302:13: warning: 'rfc.max_pdu_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.max_pdu_size' was declared here
net/bluetooth/l2cap_core.c:3298:25: warning: 'rfc.monitor_timeout' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.monitor_timeout' was declared here
net/bluetooth/l2cap_core.c:3297:25: warning: 'rfc.retrans_timeout' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.retrans_timeout' was declared here
net/bluetooth/l2cap_core.c:3295:2: warning: 'rfc.mode' may be used uninitialized in this function [-Wmaybe-uninitialized]
net/bluetooth/l2cap_core.c:3266:24: note: 'rfc.mode' was declared here

Signed-off-by: Szymon Janc &lt;szymon.janc@tieto.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Fix deadlock and crash when SMP pairing times out</title>
<updated>2012-06-08T06:23:56+00:00</updated>
<author>
<name>Johan Hedberg</name>
<email>johan.hedberg@intel.com</email>
</author>
<published>2012-06-06T10:44:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d06cc416f517a25713dedd9e2a9ccf4f3086c09a'/>
<id>d06cc416f517a25713dedd9e2a9ccf4f3086c09a</id>
<content type='text'>
The l2cap_conn_del function tries to cancel_sync the security timer, but
when it's called from the timeout function itself a deadlock occurs.
Subsequently the "hcon-&gt;l2cap_data = NULL" that's supposed to protect
multiple calls to l2cap_conn_del never gets cleared and when the
connection finally drops we double free's etc which will crash the
kernel.

This patch fixes the issue by using the HCI_CONN_LE_SMP_PEND for
protecting against this. The same flag is also used for the same purpose
in other places in the SMP code.

Signed-off-by: Johan Hedberg &lt;johan.hedberg@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>
The l2cap_conn_del function tries to cancel_sync the security timer, but
when it's called from the timeout function itself a deadlock occurs.
Subsequently the "hcon-&gt;l2cap_data = NULL" that's supposed to protect
multiple calls to l2cap_conn_del never gets cleared and when the
connection finally drops we double free's etc which will crash the
kernel.

This patch fixes the issue by using the HCI_CONN_LE_SMP_PEND for
protecting against this. The same flag is also used for the same purpose
in other places in the SMP code.

Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo.padovan@collabora.co.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Create flags for bt_sk()</title>
<updated>2012-05-16T19:14:17+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo@padovan.org</email>
</author>
<published>2012-05-16T15:17:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c5daa683f2d3315cd766f550ef7d88bfca1671f4'/>
<id>c5daa683f2d3315cd766f550ef7d88bfca1671f4</id>
<content type='text'>
defer_setup and suspended are now flags into bt_sk().

Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
defer_setup and suspended are now flags into bt_sk().

Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Restore locking semantics when looking up L2CAP channels</title>
<updated>2012-05-16T19:13:51+00:00</updated>
<author>
<name>Mat Martineau</name>
<email>mathewm@codeaurora.org</email>
</author>
<published>2012-05-02T16:42:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=ef191aded58c5e6860b01f463818584a420a4d6b'/>
<id>ef191aded58c5e6860b01f463818584a420a4d6b</id>
<content type='text'>
As the comment for l2cap_get_chan_by_scid indicated, the function used
to return a locked socket.  The lock for the socket was acquired while
the channel list was also locked.

When locking was moved over to the l2cap_chan structure, the channel
lock was no longer acquired with the channel list still locked.  This
made it possible for the l2cap_chan to be deleted after
conn-&gt;chan_lock was released but before l2cap_chan_lock was called.
Making the call to l2cap_chan_lock before releasing conn-&gt;chan_lock
makes it impossible for the l2cap_chan to be deleted at the wrong
time.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Reviewed-by: Ulisses Furquim &lt;ulisses@profusion.mobi&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As the comment for l2cap_get_chan_by_scid indicated, the function used
to return a locked socket.  The lock for the socket was acquired while
the channel list was also locked.

When locking was moved over to the l2cap_chan structure, the channel
lock was no longer acquired with the channel list still locked.  This
made it possible for the l2cap_chan to be deleted after
conn-&gt;chan_lock was released but before l2cap_chan_lock was called.
Making the call to l2cap_chan_lock before releasing conn-&gt;chan_lock
makes it impossible for the l2cap_chan to be deleted at the wrong
time.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Reviewed-by: Ulisses Furquim &lt;ulisses@profusion.mobi&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Fix a redundant and problematic incoming MTU check</title>
<updated>2012-05-16T19:13:37+00:00</updated>
<author>
<name>Mat Martineau</name>
<email>mathewm@codeaurora.org</email>
</author>
<published>2012-05-02T16:41:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=35c84d76ee52f49fe2635d8cd686b5b658e8d892'/>
<id>35c84d76ee52f49fe2635d8cd686b5b658e8d892</id>
<content type='text'>
The L2CAP MTU for incoming data is verified differently depending on
the L2CAP mode, so the check is best performed in a mode-specific
context.  Checking the incoming MTU before HCI fragment reassembly is
a layer violation and assumes all bytes after the standard L2CAP
header are L2CAP data.

This approach causes issues with unsegmented ERTM or streaming mode
frames, where there are additional enhanced or extended headers before
the data payload and possible FCS bytes after the data payload.  A
valid frame could be as many as 10 bytes larger than the MTU.

Removing this code is the best fix, because the MTU is checked later
on for all L2CAP data frames (connectionless, basic, ERTM, and
streaming).  This also gets rid of outdated locking (socket instead of
l2cap_chan) and an extra lookup of the channel ID.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Reviewed-by: Ulisses Furquim &lt;ulisses@profusion.mobi&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The L2CAP MTU for incoming data is verified differently depending on
the L2CAP mode, so the check is best performed in a mode-specific
context.  Checking the incoming MTU before HCI fragment reassembly is
a layer violation and assumes all bytes after the standard L2CAP
header are L2CAP data.

This approach causes issues with unsegmented ERTM or streaming mode
frames, where there are additional enhanced or extended headers before
the data payload and possible FCS bytes after the data payload.  A
valid frame could be as many as 10 bytes larger than the MTU.

Removing this code is the best fix, because the MTU is checked later
on for all L2CAP data frames (connectionless, basic, ERTM, and
streaming).  This also gets rid of outdated locking (socket instead of
l2cap_chan) and an extra lookup of the channel ID.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Reviewed-by: Ulisses Furquim &lt;ulisses@profusion.mobi&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: improve readability of l2cap_seq_list code</title>
<updated>2012-05-16T19:13:06+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo@padovan.org</email>
</author>
<published>2012-05-09T21:28:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f522ae363d5f20de172ea6f9973ba4cc44801f2b'/>
<id>f522ae363d5f20de172ea6f9973ba4cc44801f2b</id>
<content type='text'>
Removes one indentation level.

Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Removes one indentation level.

Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Fix skb length calculation</title>
<updated>2012-05-16T19:12:56+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo@padovan.org</email>
</author>
<published>2012-05-11T16:16:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2d0ed3d5879edae4bf1c98eb3163466c30d41789'/>
<id>2d0ed3d5879edae4bf1c98eb3163466c30d41789</id>
<content type='text'>
When we add a fragment to a skb, len and data_len fields need to be
updated.

Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we add a fragment to a skb, len and data_len fields need to be
updated.

Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Fix wrong set of skb fragments</title>
<updated>2012-05-16T19:12:32+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo@padovan.org</email>
</author>
<published>2012-05-15T16:22:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=fbe0070092c3968927c63ab56c00b47c6aa3770f'/>
<id>fbe0070092c3968927c63ab56c00b47c6aa3770f</id>
<content type='text'>
If alloc() fails we let the frags linked list with garbage value (the
err ptr value) in its last element.

Reported-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If alloc() fails we let the frags linked list with garbage value (the
err ptr value) in its last element.

Reported-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
Signed-off-by: Johan Hedberg &lt;johan.hedberg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth</title>
<updated>2012-05-16T19:11:44+00:00</updated>
<author>
<name>Gustavo Padovan</name>
<email>gustavo.padovan@collabora.co.uk</email>
</author>
<published>2012-05-16T19:11:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=08e6d907fe606b751adddce54ad8f51e0950bc3f'/>
<id>08e6d907fe606b751adddce54ad8f51e0950bc3f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Bluetooth: Initialize the transmit queue for L2CAP streaming mode</title>
<updated>2012-05-15T23:28:16+00:00</updated>
<author>
<name>Mat Martineau</name>
<email>mathewm@codeaurora.org</email>
</author>
<published>2012-05-14T21:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d34c34fb2592bd5231a153ad1676c3ded175410a'/>
<id>d34c34fb2592bd5231a153ad1676c3ded175410a</id>
<content type='text'>
Commit 105bdf9ec19e729bacdb33861c74fcf3eb39eb37 introduced a
regression in L2CAP streaming mode due to rearranged initialization
code that is shared between ERTM and streaming mode.  This change
makes sure the transmit queue is initialized in both modes.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Acked-by: Andrei Emeltchenko &lt;andrei.emeltchenko@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 105bdf9ec19e729bacdb33861c74fcf3eb39eb37 introduced a
regression in L2CAP streaming mode due to rearranged initialization
code that is shared between ERTM and streaming mode.  This change
makes sure the transmit queue is initialized in both modes.

Signed-off-by: Mat Martineau &lt;mathewm@codeaurora.org&gt;
Acked-by: Andrei Emeltchenko &lt;andrei.emeltchenko@intel.com&gt;
Signed-off-by: Gustavo Padovan &lt;gustavo@padovan.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
