kernel/kernel-mfld-blackbay.git
13 years agoBluetooth: include scatterlist.h where needed
Stephen Rothwell [Thu, 23 Jun 2011 02:58:55 +0000 (12:58 +1000)]
Bluetooth: include scatterlist.h where needed

net/bluetooth/smp.c: In function 'smp_e':
net/bluetooth/smp.c:49:21: error: storage size of 'sg' isn't known
net/bluetooth/smp.c:67:2: error: implicit declaration of function 'sg_init_one'
net/bluetooth/smp.c:49:21: warning: unused variable 'sg'

Caused by commit d22ef0bc83c5 ("Bluetooth: Add LE SMP Cryptoolbox
functions").  Missing include file, presumably.  This batch has been in
the bluetooth tree since June 14, so it may have been exposed by the
removal of linux/mm.h from netdevice.h ...

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
13 years agoBluetooth: Fix not setting the chan state
Vinicius Costa Gomes [Mon, 20 Jun 2011 21:53:18 +0000 (18:53 -0300)]
Bluetooth: Fix not setting the chan state

When the connection is ready we should set the connection
to CONNECTED so userspace can use it.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove useless access to the socket
Vinicius Costa Gomes [Sat, 18 Jun 2011 01:46:27 +0000 (22:46 -0300)]
Bluetooth: Remove useless access to the socket

We already have access to the chan, we don't have to access the
socket to get its imtu.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix crash when setting a LE socket to ready
Vinicius Costa Gomes [Sat, 18 Jun 2011 01:46:26 +0000 (22:46 -0300)]
Bluetooth: Fix crash when setting a LE socket to ready

We should not try to do any other type of configuration for
LE links when they become ready.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix locking in blacklist code
Gustavo F. Padovan [Fri, 17 Jun 2011 19:15:10 +0000 (16:15 -0300)]
Bluetooth: Fix locking in blacklist code

There was no unlock call on the errors path

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Use bit operations on conn_state
Gustavo F. Padovan [Sat, 11 Jun 2011 00:28:49 +0000 (21:28 -0300)]
Bluetooth: Use bit operations on conn_state

Instead of setting bits manually we use set_bit, test_bit, etc.
Also remove L2CAP_ prefix from macros.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: use bit operation on conf_state
Gustavo F. Padovan [Fri, 10 Jun 2011 20:02:12 +0000 (17:02 -0300)]
Bluetooth: use bit operation on conf_state

Instead of making the bit operations manually, we now use set_bit,
test_bit, etc.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add blacklisting support for mgmt interface
Antti Julku [Wed, 15 Jun 2011 09:01:15 +0000 (12:01 +0300)]
Bluetooth: Add blacklisting support for mgmt interface

Management interface commands for blocking and unblocking devices.

Signed-off-by: Antti Julku <antti.julku@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Move blacklisting functions to hci_core
Antti Julku [Wed, 15 Jun 2011 09:01:14 +0000 (12:01 +0300)]
Bluetooth: Move blacklisting functions to hci_core

Move blacklisting functions to hci_core.c, so that they can
be used by both management interface and hci socket interface.

Signed-off-by: Antti Julku <antti.julku@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add key size checks for SMP
Vinicius Costa Gomes [Tue, 14 Jun 2011 16:37:42 +0000 (13:37 -0300)]
Bluetooth: Add key size checks for SMP

This patch implements a check in smp cmd pairing request and pairing
response to verify if encryption key maximum size is compatible in both
slave and master when SMP Pairing is requested. Keys are also masked to
the correct negotiated size.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for SMP timeout
Vinicius Costa Gomes [Tue, 14 Jun 2011 16:37:41 +0000 (13:37 -0300)]
Bluetooth: Add support for SMP timeout

This patch adds support for disconnecting the link when SMP procedure
takes more than 30 seconds.

SMP begins when either the Pairing Request command is sent or the
Pairing Response is received, and it ends when the link is encrypted
(or terminated). Vol 3, Part H Section 3.4.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: fix missing parameter for HCI_OP_DISCONNECT
Anderson Lizardo [Mon, 13 Jun 2011 19:42:03 +0000 (15:42 -0400)]
Bluetooth: fix missing parameter for HCI_OP_DISCONNECT

The "dc" variable is initialized but not passed to hci_send_cmd().

Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
Signed-off-by: Bruna Moreira <bruna.moreira@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for Pairing features exchange
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:53 +0000 (18:50 -0300)]
Bluetooth: Add support for Pairing features exchange

This patch implements a simple version of the SMP Pairing Features
exchange procedure (Vol. 3 Part H, Section 2.3.5.1).

For now, everything that would cause a Pairing Method different of
Just Works to be chosen is rejected.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for building pairing commands
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:52 +0000 (18:50 -0300)]
Bluetooth: Add support for building pairing commands

Before we are able to do a proper exchange of pairing parameters,
we need a unified way of building pairing requests and responses.

For IO Capability we use the value that was set by userspace,
using the management interface.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Update the security level when link is encrypted
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:51 +0000 (18:50 -0300)]
Bluetooth: Update the security level when link is encrypted

If the pending security level is greater than the current security
level and the link is now encrypted, we should update the link
security level.

This is only useful for LE links, when the only event generated
when SMP is sucessful in the Encrypt Change event.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix initial security level of LE links
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:50 +0000 (18:50 -0300)]
Bluetooth: Fix initial security level of LE links

As the default security level (BT_SECURITY_SDP) doesn't make sense for
LE links, initialize LE links with something that makes sense.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for resuming socket when SMP is finished
Vinicius Costa Gomes [Thu, 27 Jan 2011 00:42:57 +0000 (21:42 -0300)]
Bluetooth: Add support for resuming socket when SMP is finished

This adds support for resuming the user space traffic when SMP
negotiation is complete.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove debug statements
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:48 +0000 (18:50 -0300)]
Bluetooth: Remove debug statements

Now that these commands are sent to the controller we can use hcidump
to verify that the correct values are produced.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for LE Start Encryption
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:47 +0000 (18:50 -0300)]
Bluetooth: Add support for LE Start Encryption

This adds support for starting SMP Phase 2 Encryption, when the initial
SMP negotiation is successful. This adds the LE Start Encryption and LE
Long Term Key Request commands and related events.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add SMP confirmation checks methods
Anderson Briglia [Thu, 9 Jun 2011 21:50:46 +0000 (18:50 -0300)]
Bluetooth: Add SMP confirmation checks methods

This patch includes support for generating and sending the random value
used to produce the confirmation value.

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add SMP confirmation structs
Anderson Briglia [Thu, 9 Jun 2011 21:50:45 +0000 (18:50 -0300)]
Bluetooth: Add SMP confirmation structs

This patch adds initial support for verifying the confirmation value
that the remote side has sent.

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add LE SMP Cryptoolbox functions
Anderson Briglia [Thu, 9 Jun 2011 21:50:44 +0000 (18:50 -0300)]
Bluetooth: Add LE SMP Cryptoolbox functions

This patch implements SMP crypto functions called ah, c1, s1 and e.
It also implements auxiliary functions. All These functions are needed
for SMP keys generation.

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
Signed-off-by: Bruna Moreira <bruna.moreira@openbossa.org>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add support for using the crypto subsystem
Vinicius Costa Gomes [Thu, 9 Jun 2011 21:50:43 +0000 (18:50 -0300)]
Bluetooth: Add support for using the crypto subsystem

This will allow using the crypto subsystem for encrypting data. As SMP
(Security Manager Protocol) is implemented almost entirely on the host
side and the crypto module already implements the needed methods
(AES-128), it makes sense to use it.

There's now a new module option to enable/disable SMP support.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add simple SMP pairing negotiation
Anderson Briglia [Thu, 9 Jun 2011 21:50:42 +0000 (18:50 -0300)]
Bluetooth: Add simple SMP pairing negotiation

This implementation only exchanges SMP messages between the Host and the
Remote. No keys are being generated. TK and STK generation will be
provided in further patches.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Start SMP procedure
Anderson Briglia [Tue, 7 Jun 2011 21:46:31 +0000 (18:46 -0300)]
Bluetooth: Start SMP procedure

Start SMP procedure for LE connections. This modification intercepts
l2cap received frames and call proper SMP functions to start the SMP
procedure. By now, no keys are being used.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Implement the first SMP commands
Anderson Briglia [Thu, 9 Jun 2011 21:50:40 +0000 (18:50 -0300)]
Bluetooth: Implement the first SMP commands

These simple commands will allow the SMP procedure to be started
and terminated with a not supported error. This is the first step
toward something useful.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Don't forget to check for LE_LINK
Gustavo F. Padovan [Wed, 8 Jun 2011 22:09:13 +0000 (19:09 -0300)]
Bluetooth: Don't forget to check for LE_LINK

Otherwise the wrong error can be returned.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: keep reference if any ERTM timer is enabled
Gustavo F. Padovan [Tue, 17 May 2011 18:13:19 +0000 (15:13 -0300)]
Bluetooth: keep reference if any ERTM timer is enabled

ERTM use the generic L2CAP timer functions to keep a reference to the
channel. This is useful for avoiding crashes.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Make timer functions generic
Gustavo F. Padovan [Tue, 17 May 2011 17:59:01 +0000 (14:59 -0300)]
Bluetooth: Make timer functions generic

We now plan to use l2cap_set_timer and l2cap_clear_timer in ERTM timers.

Change-Id: Ie62b01e003f8885ae89c73e2e64195c21cbadddd
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add refcnt to struct l2cap_chan
Gustavo F. Padovan [Tue, 17 May 2011 17:34:52 +0000 (14:34 -0300)]
Bluetooth: Add refcnt to struct l2cap_chan

struct l2cap_chan has now its own refcnt that is compatible with the
socket refcnt, i.e., we won't see sk_refcnt = 0 and chan->refcnt > 0.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add state tracking to struct l2cap_chan
Gustavo F. Padovan [Fri, 3 Jun 2011 03:19:47 +0000 (00:19 -0300)]
Bluetooth: Add state tracking to struct l2cap_chan

Now socket state is tracked by struct sock and channel state is tracked by
chan->state. At this point both says the same, but this is going to change
when we add AMP Support for example.

Change-Id: Idbf873f5e8dd94f5b2482ba960c52193d28ce5dd
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: add close() callback to l2cap_chan_ops
Gustavo F. Padovan [Mon, 16 May 2011 21:23:24 +0000 (18:23 -0300)]
Bluetooth: add close() callback to l2cap_chan_ops

close() calls l2cap_sock_kill() on l2cap_sock.c

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: add recv() callback to l2cap_chan_ops
Gustavo F. Padovan [Mon, 16 May 2011 20:57:22 +0000 (17:57 -0300)]
Bluetooth: add recv() callback to l2cap_chan_ops

This abstracts the call to sock_queue_recv_skb() into
l2cap_chan_ops->recv().

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add l2cap_chan_ops abstraction
Gustavo F. Padovan [Mon, 16 May 2011 20:24:37 +0000 (17:24 -0300)]
Bluetooth: Add l2cap_chan_ops abstraction

Add an abstraction layer between L2CAP core and its users (only
l2cap_sock.c now). The first function implemented is new_connection() that
replaces calls to l2cap_sock_alloc() in l2cap_core.c

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Merge l2cap_chan_create() in the l2cap_sock_alloc()
Gustavo F. Padovan [Mon, 16 May 2011 19:42:01 +0000 (16:42 -0300)]
Bluetooth: Merge l2cap_chan_create() in the l2cap_sock_alloc()

As a first step to remove l2cap_sock_alloc() and l2cap_sock_init() from
l2cap_core.c

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Clean up some code style issues
Waldemar Rymarkiewicz [Tue, 7 Jun 2011 09:18:06 +0000 (11:18 +0200)]
Bluetooth: Clean up some code style issues

Fix lines longer than 80 chars in length.

Change-Id: I448077965c5f7723a4a9537977bfa664cfe104fd
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Kill set but unused variable 'cmd' in cmtp_recv_capimsg()
David Miller [Thu, 19 May 2011 21:50:05 +0000 (17:50 -0400)]
Bluetooth: Kill set but unused variable 'cmd' in cmtp_recv_capimsg()

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
Stephen Boyd [Thu, 12 May 2011 23:50:09 +0000 (16:50 -0700)]
Bluetooth: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning

Enabling DEBUG_STRICT_USER_COPY_CHECKS causes the following
warning:

In function 'copy_from_user',
    inlined from 'rfcomm_sock_setsockopt' at
    net/bluetooth/rfcomm/sock.c:705:
arch/x86/include/asm/uaccess_64.h:65:
warning: call to 'copy_from_user_overflow' declared with
attribute warning: copy_from_user() buffer size is not provably
correct

presumably due to buf_size being signed causing GCC to fail to
see that buf_size can't become negative.

Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix check for the ERTM local busy state
Mat Martineau [Fri, 3 Jun 2011 23:21:10 +0000 (16:21 -0700)]
Bluetooth: Fix check for the ERTM local busy state

Local busy is encoded in a bitfield, but was not masked out correctly.

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Restore accidentally-deleted line
Mat Martineau [Fri, 3 Jun 2011 23:21:07 +0000 (16:21 -0700)]
Bluetooth: Restore accidentally-deleted line

When code was moved from l2cap_core.c to l2cap_sock.c in commit
6de0702b5b93da0ef097aa092b4597fbc024ebba, one line was dropped
from the old __l2cap_sock_close() implementation. This sk_state
change should still be in l2cap_chan_close().

Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Simplify hci_conn_accept_secure check
Waldemar Rymarkiewicz [Thu, 2 Jun 2011 12:24:52 +0000 (14:24 +0200)]
Bluetooth: Simplify hci_conn_accept_secure check

If the link key is secure (authenticated or combination 16 digit)
the sec_level will be always BT_SECURITY_HIGH. Therefore, instead
of checking the link key type simply check the sec_level on the link.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add BT_POWER L2CAP socket option.
Jaikumar Ganesh [Tue, 24 May 2011 01:06:04 +0000 (18:06 -0700)]
Bluetooth: Add BT_POWER L2CAP socket option.

Add BT_POWER socket option used to control the power
characteristics of the underlying ACL link. When the remote end
has put the link in sniff mode and the host stack wants to send
data we need need to explicitly exit sniff mode to work well with
certain devices (For example, A2DP on Plantronics Voyager 855).
However, this causes problems with HID devices.

Hence, moving into active mode when sending data, irrespective
of who set the sniff mode has been made as a socket option. By
default, we will move into active mode. HID devices can set the
L2CAP socket option to prevent this from happening.

Currently, this has been implemented for L2CAP sockets. This has been
tested with incoming and outgoing L2CAP sockets for HID and A2DP.

Based on discussions on linux-bluetooth and patches submitted by
Andrei Emeltchenko.

Signed-off-by: Jaikumar Ganesh <jaikumar@google.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Verify a pin code in pin_code_reply
Waldemar Rymarkiewicz [Wed, 1 Jun 2011 15:28:48 +0000 (17:28 +0200)]
Bluetooth: Verify a pin code in pin_code_reply

As we cannot relay on a userspace mgmt api implementation we should verify
if pin_code_reply in fact contains the secure pin code.

If userspace replied with unsecure pincode when secure was required we will
send pin_code_neg_reply to the controller.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove a magic number
Waldemar Rymarkiewicz [Wed, 1 Jun 2011 15:28:47 +0000 (17:28 +0200)]
Bluetooth: Remove a magic number

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: fix sparse & gcc warnings
Johannes Berg [Wed, 1 Jun 2011 06:54:45 +0000 (08:54 +0200)]
Bluetooth: fix sparse & gcc warnings

sparse complains about a few things that should
be static.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Set 'peer_addr_type' in hci_le_connect()
Andre Guedes [Tue, 31 May 2011 17:20:57 +0000 (14:20 -0300)]
Bluetooth: Set 'peer_addr_type' in hci_le_connect()

Set the 'peer_addr_type' field of the LE Create Connection command
sent in hci_le_connect().

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Ville Tervo <ville.tervo@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Check advertising cache in hci_connect()
Andre Guedes [Tue, 31 May 2011 17:20:56 +0000 (14:20 -0300)]
Bluetooth: Check advertising cache in hci_connect()

When connecting to a LE device, we need to check the advertising
cache in order to know the address type of that device.

If its advertising entry is not found, the connection is not
established and hci_connect() returns error.

Change-Id: I234912abc53b859becbe79625b08bc3b6eacc143
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Ville Tervo <ville.tervo@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove useless check in hci_connect()
Andre Guedes [Tue, 31 May 2011 17:20:55 +0000 (14:20 -0300)]
Bluetooth: Remove useless check in hci_connect()

There is no need to check the connection's state since hci_conn_add()
has just created a new connection and its state has been set properly.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Ville Tervo <ville.tervo@nokia.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add 'dst_type' field to struct hci_conn
Andre Guedes [Tue, 31 May 2011 17:20:54 +0000 (14:20 -0300)]
Bluetooth: Add 'dst_type' field to struct hci_conn

This patch adds a new field (dst_type) to the struct hci_conn which
holds the type of the destination address (bdaddr_t dst). This
approach is needed in order to use the struct hci_conn as an
abstraction of LE connections in HCI Layer. For non-LE this field
is ignored.

This patch also set properly the 'dst_type' field after initializing
LE hci_conn structures.

Change-Id: I1e363bb6de263fdb1fe976a5a16ed5debc9b8c0c
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Refactor hci_auth_complete_evt function
Waldemar Rymarkiewicz [Tue, 31 May 2011 13:49:26 +0000 (15:49 +0200)]
Bluetooth: Refactor hci_auth_complete_evt function

Replace if(conn) with if(!conn) checking to avoid too many nested statements

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Fix auth_complete_evt for legacy units
Waldemar Rymarkiewicz [Tue, 31 May 2011 13:49:25 +0000 (15:49 +0200)]
Bluetooth: Fix auth_complete_evt for legacy units

Legacy devices don't re-authenticate the link properly if a link key
already exists.  Thus, don't update sec_level for this case even if
hci_auth_complete_evt indicates success. Otherwise the sec_level will
not reflect a real security on the link.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Advertising entries lifetime
Andre Guedes [Thu, 26 May 2011 19:23:53 +0000 (16:23 -0300)]
Bluetooth: Advertising entries lifetime

This patch adds a timer to clear 'adv_entries' after three minutes.

After some amount of time, the advertising entries cached during
the last LE scan should be considered expired and they should be
removed from the advertising cache.

It was chosen a three minutes timeout as an initial attempt. This
value might change in future.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Clear advertising cache before scanning
Andre Guedes [Thu, 26 May 2011 19:23:52 +0000 (16:23 -0300)]
Bluetooth: Clear advertising cache before scanning

The LE advertising cache should be cleared before performing a LE
scanning. This will force the cache to contain only fresh advertising
entries.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add Advertising Report Meta Event handler
Andre Guedes [Thu, 26 May 2011 19:23:51 +0000 (16:23 -0300)]
Bluetooth: Add Advertising Report Meta Event handler

This patch adds a function to handle LE Advertising Report Meta
Events.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: LE advertising cache
Andre Guedes [Thu, 26 May 2011 19:23:50 +0000 (16:23 -0300)]
Bluetooth: LE advertising cache

This patch implements the LE advertising cache. It stores sensitive
information (bdaddr and bdaddr_type so far) gathered from LE
advertising report events.

Only advertising entries from connectables devices are added to the
cache.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add advertising report meta event structs
Anderson Briglia [Thu, 26 May 2011 19:23:49 +0000 (16:23 -0300)]
Bluetooth: Add advertising report meta event structs

This patch adds definitions and a new struct for Advertising Report
Event from LE and Dual Mode controllers.

Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Rename __l2cap_chan_close() to l2cap_chan_close()
Gustavo F. Padovan [Wed, 4 May 2011 22:42:50 +0000 (19:42 -0300)]
Bluetooth: Rename __l2cap_chan_close() to l2cap_chan_close()

To make it consistent with the rest of the API.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove export of l2cap_chan_clear_timer()
Gustavo F. Padovan [Wed, 4 May 2011 22:35:27 +0000 (19:35 -0300)]
Bluetooth: Remove export of l2cap_chan_clear_timer()

The call to l2cap_chan_clear_timer() is not really needed in l2cap_sock.c.
This patch also adds a call to l2cap_chan_clear_timer() to the only place
in __l2cap_sock_close() that wasn't calling it. It's safe call it there
because l2cap_chan_clear_timer() check first for timer_peding().

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: create channel timer to replace sk_timer
Gustavo F. Padovan [Mon, 2 May 2011 21:25:01 +0000 (18:25 -0300)]
Bluetooth: create channel timer to replace sk_timer

The new timer does not belong to struct sock, tought it still touch some
sock things, but this will be sorted out soon.

Change-Id: I55dc122657f3b8e80e76acf8c479e2d5c9889af5
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Add chan->chan_type struct member
Gustavo F. Padovan [Mon, 2 May 2011 20:13:55 +0000 (17:13 -0300)]
Bluetooth: Add chan->chan_type struct member

chan_type says if our chan is raw(direclty access to HCI),
connection less or connection oriented.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Create l2cap_chan_send()
Gustavo F. Padovan [Thu, 28 Apr 2011 21:50:17 +0000 (18:50 -0300)]
Bluetooth: Create l2cap_chan_send()

This move all the sending logic to l2cap_core.c, but we still have a
socket dependence there, struct msghdr. It will be removed in some of the
further commits.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Create __l2cap_chan_close()
Gustavo F. Padovan [Thu, 28 Apr 2011 20:55:53 +0000 (17:55 -0300)]
Bluetooth: Create __l2cap_chan_close()

This is actually __l2cap_sock_close() renamed to __l2cap_chan_close().
At a first look it may not make sense, but with the further cleanups that
will come it will.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Remove unnecessary use of hci_dev_list_lock
Johan Hedberg [Fri, 20 May 2011 18:50:41 +0000 (11:50 -0700)]
Bluetooth: Remove unnecessary use of hci_dev_list_lock

The get_connections function has no need to use hci_dev_list_lock. The
code was there probably because of a copy-paste mistake.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Kill set but not used variable 'l2cap_sk' in rfcomm_sock_getsockopt_old()
David Miller [Thu, 19 May 2011 22:09:00 +0000 (18:09 -0400)]
Bluetooth: Kill set but not used variable 'l2cap_sk' in rfcomm_sock_getsockopt_old()

Change-Id: I33c0404c6dcf1d3e8bc39e8c583f073329add294
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: fix set but not used warning
Gustavo F. Padovan [Wed, 18 May 2011 21:14:45 +0000 (18:14 -0300)]
Bluetooth: fix set but not used warning

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agoBluetooth: Allow unsegmented SDU retries on sock_queue_rcv_skb failure
Ruiyi Zhang [Fri, 13 May 2011 05:07:52 +0000 (13:07 +0800)]
Bluetooth: Allow unsegmented SDU retries on sock_queue_rcv_skb failure

In L2CAP_SDU_UNSEGMENTED case, if sock_queue_rcv_skb returns error,
l2cap_ertm_reassembly_sdu should not return 0 so as to insert the
skb into BUSY_QUEUE for later retries.

Signed-off-by: Ruiyi Zhang <Ruiyi.Zhang@Atheros.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
13 years agonet: wireless: bcmdhd: Fix crash if event queue is empty
Dmitry Shmidt [Mon, 11 Jul 2011 17:48:09 +0000 (10:48 -0700)]
net: wireless: bcmdhd: Fix crash if event queue is empty

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Fix CFG80211 suspend/resume if interface is down
Dmitry Shmidt [Mon, 11 Jul 2011 17:45:33 +0000 (10:45 -0700)]
net: wireless: bcmdhd: Fix CFG80211 suspend/resume if interface is down

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Add setband/getband private commands
Dmitry Shmidt [Fri, 8 Jul 2011 22:33:58 +0000 (15:33 -0700)]
net: wireless: bcmdhd: Add setband/getband private commands

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Add packet filtering commands
Dmitry Shmidt [Fri, 8 Jul 2011 00:04:44 +0000 (17:04 -0700)]
net: wireless: bcmdhd: Add packet filtering commands

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agogpu: ion: Validate handles passed via the kernel api
Rebecca Schultz Zavin [Fri, 8 Jul 2011 00:07:56 +0000 (17:07 -0700)]
gpu: ion: Validate handles passed via the kernel api

Before freeing or sharing handles, confirm that they
are valid in the provided client

Change-Id: I06ec599c0b277fcb5417325a12ecbf8b2d248a7b
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agoplist: Remove the need to supply locks to plist heads
Dima Zavin [Fri, 8 Jul 2011 00:27:59 +0000 (17:27 -0700)]
plist: Remove the need to supply locks to plist heads

This was legacy code brought over from the RT tree and
is no longer necessary.

Signed-off-by: Dima Zavin <dima@android.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Walker <dwalker@codeaurora.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Link: http://lkml.kernel.org/r/1310084879-10351-2-git-send-email-dima@android.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
13 years agonet: wireless: bcmdhd: Fix private command output
Dmitry Shmidt [Thu, 7 Jul 2011 21:57:23 +0000 (14:57 -0700)]
net: wireless: bcmdhd: Fix private command output

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonetfitler: xt_qtaguid: add another missing spin_unlock.
JP Abgrall [Thu, 7 Jul 2011 03:09:38 +0000 (20:09 -0700)]
netfitler: xt_qtaguid: add another missing spin_unlock.

This time the symptom is caused by tagging the same socket twice
without untagging it in between.
This would cause it to not unlock, and return.

Signed-off-by: JP Abgrall <jpa@google.com>
13 years agoion: fix ION_HEAP_<xxx>_MASK definitions
Iliyan Malchev [Wed, 6 Jul 2011 23:53:21 +0000 (16:53 -0700)]
ion: fix ION_HEAP_<xxx>_MASK definitions

Signed-off-by: Iliyan Malchev <malchev@google.com>
13 years agoUSB: OTG: Take wakelock when VBUS present
Todd Poynor [Sat, 2 Jul 2011 00:19:56 +0000 (17:19 -0700)]
USB: OTG: Take wakelock when VBUS present

Enabled by default, can disable with:
   echo N > /sys/module/otg_wakelock/parameters/enabled

Change-Id: I34974624c52ae23490852b44c270d2f326cf6116
Signed-off-by: Todd Poynor <toddpoynor@google.com>
13 years agogpu: ion: Fix deferencing ERR_PTR
Choi, Jong-Hwan [Thu, 7 Jul 2011 00:07:04 +0000 (09:07 +0900)]
gpu: ion: Fix deferencing ERR_PTR

Change-Id: I986c380d75591571890f1a2cba1405e66789b25c
Signed-off-by: Choi, Jong-Hwan <jhbird.choi@samsung.com>
13 years agogpu: ion: Fix possible memory leak
Choi, Jong-Hwan [Thu, 7 Jul 2011 00:06:17 +0000 (09:06 +0900)]
gpu: ion: Fix possible memory leak

Change-Id: I66f5ad2c95513dfab9f4fc5ae2fcb1316f486d34
Signed-off-by: Choi, Jong-Hwan <jhbird.choi@samsung.com>
13 years agogpu: ion: Remove redunant code from ion_open
Rebecca Schultz Zavin [Thu, 7 Jul 2011 01:07:24 +0000 (18:07 -0700)]
gpu: ion: Remove redunant code from ion_open

ion_client_create now does a lookup, so this need not
also be done from ion_open

Change-Id: Icb101bbf514bf2e40b4b5d9b320130bf185349aa
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agogpu: ion: Fix bug in ion client destroy
Rebecca Schultz Zavin [Thu, 7 Jul 2011 01:07:01 +0000 (18:07 -0700)]
gpu: ion: Fix bug in ion client destroy

ion_client_destroy kernel api should only delete the client
if it's refcount has gone to zero.

Change-Id: Iaa662bd82d67279a9807e01f9a24aebe3d21c17d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agonetfilter: qtaguid: fix bad-arg handling when tagging socket
JP Abgrall [Wed, 6 Jul 2011 19:05:49 +0000 (12:05 -0700)]
netfilter: qtaguid: fix bad-arg handling when tagging socket

When processing args passed to the procfs ctrl, if the tag was
invalid it would exit without releasing the spin_lock...
Bye bye scheduling.

Signed-off-by: JP Abgrall <jpa@google.com>
Change-Id: Ic1480ae9d37bba687586094cf6d0274db9c5b28a

13 years agogpu: ion: Fix bug in ion_client_create
Rebecca Schultz Zavin [Sat, 2 Jul 2011 03:41:25 +0000 (20:41 -0700)]
gpu: ion: Fix bug in ion_client_create

If a process already had a client, ion_client_create
would loop forever.

Change-Id: I723207b5872dfc11be04ca27d38a3cf39c4a1426
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agonet: wireless: bcmdhd: Set interface name to 'wlan' by default
Dmitry Shmidt [Thu, 30 Jun 2011 21:05:42 +0000 (14:05 -0700)]
net: wireless: bcmdhd: Set interface name to 'wlan' by default

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Fix pm_notifier unregistration
Dmitry Shmidt [Thu, 30 Jun 2011 17:09:06 +0000 (10:09 -0700)]
net: wireless: bcmdhd: Fix pm_notifier unregistration

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Postpone driver init call
Dmitry Shmidt [Thu, 30 Jun 2011 17:04:16 +0000 (10:04 -0700)]
net: wireless: bcmdhd: Postpone driver init call

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Add private start/stop commands
Dmitry Shmidt [Thu, 30 Jun 2011 16:54:27 +0000 (09:54 -0700)]
net: wireless: bcmdhd: Add private start/stop commands

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Fix MAC address setting
Dmitry Shmidt [Wed, 29 Jun 2011 23:03:25 +0000 (16:03 -0700)]
net: wireless: bcmdhd: Fix MAC address setting

If MAC address setting fails from wifi_get_mac_addr() it will be picked up
from nvram.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agoUpdate to 5.90.125.33
Greg Goldman [Wed, 29 Jun 2011 21:34:18 +0000 (14:34 -0700)]
Update to 5.90.125.33
Add logic to get MAC address before firmware is loaded

Change-Id: I2151a0fcc5aab914cfec8bfedf761b9f06445d1a
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Add SETFWPATH private command
Dmitry Shmidt [Tue, 28 Jun 2011 22:09:49 +0000 (15:09 -0700)]
net: wireless: bcmdhd: Add SETFWPATH private command

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agonet: wireless: bcmdhd: Fix wd_timer_valid field protection
Dmitry Shmidt [Tue, 28 Jun 2011 20:57:55 +0000 (13:57 -0700)]
net: wireless: bcmdhd: Fix wd_timer_valid field protection

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agoUpdate to 5.90.125.32:
Lin Ma [Tue, 28 Jun 2011 01:53:59 +0000 (18:53 -0700)]
Update to 5.90.125.32:
* Move Android specific functions to wl_android (wifi control functions,
  wifi device, pre-alloc buffer.)
* Link Android start/stop commands to interface up/down (download firmware
  when primary interfacde is up.)
* Fix a issue in driver unload, the same IRQ can not be disabled twice
  (set_irq_wake)

Change-Id: Id49c4f746f69371323c9a34834c3b628b78ff713
Signed-off-by: Howard M. Harte <hharte@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
13 years agogpu: ion: Remove incorrect error message
Rebecca Schultz Zavin [Fri, 1 Jul 2011 02:16:59 +0000 (19:16 -0700)]
gpu: ion: Remove incorrect error message

The function name is wrong here, and this function may
sometimes be called to see if a value passed from userspace
is an ion handle.  Since it's not really an error when it
fails, remove the log message.

Change-Id: I7bee0e7ffb72b4c4768774a3586f97e306700c21
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agogpu: ion: Fix bug in ion_buffer_add
Rebecca Schultz Zavin [Fri, 1 Jul 2011 01:09:05 +0000 (18:09 -0700)]
gpu: ion: Fix bug in ion_buffer_add

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agogpu: ion: Several fixes
Rebecca Schultz Zavin [Thu, 30 Jun 2011 19:19:55 +0000 (12:19 -0700)]
gpu: ion: Several fixes

Fix some cases where locks were not released on error paths
Change heap->prio to heap->id to make meaning clearer
Fix kernel doc to match sources

13 years agogpu: ion: Add ION Memory Manager
Rebecca Schultz Zavin [Thu, 30 Jun 2011 02:44:29 +0000 (19:44 -0700)]
gpu: ion: Add ION Memory Manager

Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
13 years agoRevert "PM: Prevent waiting forever on asynchronous resume after abort"
Colin Cross [Wed, 29 Jun 2011 20:43:12 +0000 (13:43 -0700)]
Revert "PM: Prevent waiting forever on asynchronous resume after abort"

This reverts commit fa92a3d6959546baa27e892188d3e9bb79c31741.

13 years agoRevert "PM: Wait for completion of the parent resume before resuming"
Colin Cross [Wed, 29 Jun 2011 20:42:56 +0000 (13:42 -0700)]
Revert "PM: Wait for completion of the parent resume before resuming"

This reverts commit a0f07aae54e87a9fad6d19c0e57398f54d858f06.

13 years agonf: qtaguid: make procfs entry for ctrl return correct data.
JP Abgrall [Tue, 28 Jun 2011 06:31:46 +0000 (23:31 -0700)]
nf: qtaguid: make procfs entry for ctrl return correct data.

(This is a direct cherry-pick from 2.6.39: I3b925802)

Fixed procreader for /proc/net/xt_qtaguid/ctrl: it would just
fill the output with the same entry.
Simplify the **start handling.

Signed-off-by: JP Abgrall <jpa@google.com>
Change-Id: I3b92580228f2b57795bb2d0d6197fc95ab6be552

13 years agonf: qtaguid: workaround xt_socket_get_sk() returning bad SKs.
JP Abgrall [Tue, 28 Jun 2011 04:03:04 +0000 (21:03 -0700)]
nf: qtaguid: workaround xt_socket_get_sk() returning bad SKs.

(This is a direct cherry pick from 2.6.39: Id2a9912b)

* xt_socket_get_sk() returns invalid sockets when the sk_state is TCP_TIME_WAIT.
Added detection of time-wait.
* Added more constrained usage: qtaguid insures that xt_socket_get*_sk() is
not invoked for unexpected hooks or protocols (but I have not seen those
active at the point where the returned sk is bad).

Signed-off-by: JP Abgrall <jpa@google.com>
Change-Id: Id2a9912bb451a3e59d012fc55bbbd40fbb90693f

13 years agonet: wireless: bcmdhd: Fix memory poisoning in wl_free_wdev()
Dmitry Shmidt [Fri, 24 Jun 2011 17:16:22 +0000 (10:16 -0700)]
net: wireless: bcmdhd: Fix memory poisoning in wl_free_wdev()

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>