Bluetooth: Fix missing length checks for L2CAP signalling PDUs

There has been code in place to check that the L2CAP length header
matches the amount of data received, but many PDU handlers have not been
checking that the data received actually matches that expected by the
specific PDU. This patch adds passing the length header to the specific
handler functions and ensures that those functions fail cleanly in the
case of an incorrect amount of data.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
[bwh: Backported to 3.2:
 - Adjust context
 - Move uses of *req below the new check in l2cap_connect_req]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
[wujg: Backported to 3.4:
 - Adjust context
 - Adjust l2cap_create_channel_rsp()'s parameters]
Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[neo: Adapt to msm-3.4]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Bluetooth: Add missing length check for L2CAP signalling PDUs

* This check is added in upstream as well, our msm-3.4 is
  quite different and so it was missed by last commit.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Bluetooth: Fix invalid length check in l2cap_information_rsp()

The length check is invalid since the length varies with type of
info response.

This was introduced by the commit cb3b3152b2f5939d67005cff841a1ca748b19888

Because of this, l2cap info rsp is not handled and command reject is sent.

> ACL data: handle 11 flags 0x02 dlen 16
        L2CAP(s): Info rsp: type 2 result 0
          Extended feature mask 0x00b8
            Enhanced Retransmission mode
            Streaming mode
            FCS Option
            Fixed Channels
< ACL data: handle 11 flags 0x00 dlen 10
        L2CAP(s): Command rej: reason 0
          Command not understood

Cc: stable@vger.kernel.org
Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
Signed-off-by: Chan-Yeol Park <chanyeol.park@samsung.com>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
BT: linux patches
Bluetooth: hci_ath: Vote off Uart clock when BT is in Sleep

When there is no communication between the BTHOST and BTSOC,
UART clock should be vote off, otherwise Uart module will
not unlock wake lock which doesn't allow system to go sleep.

CRs-fixed: 413053
Change-Id: I8067132d5c376551bf104e69ac916addbbda3d1d
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
bluetooth: hci_ath: add device tree support for atheros driver

HCI Atheros driver first checks for device tree node and if it
does not exists then checks for the platform data from the
board file.

Change-Id: I92e1cfce0d0bf074eb3baab921674e291bb462e6
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
bluetooth: hci_ath: enable driver support for bluedroid stack

Added module params to allow userspace to control the sleep
mechanism of atheros chipset.

Change-Id: I1cf563d54fa56159d227380ada784cca0c93ed23
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>