Bluetooth: Fix missing length checks for L2CAP signalling PDUs
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 28 May 2013 10:46:30 +0000 (13:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Jun 2014 19:04:13 +0000 (12:04 -0700)
commitade988a989901a1527c6809aeea0ca3b8639af46
tree4396fac8dfbd933084d060e7e9cb61c37f4e7c72
parent653b6fe704e344fe48162a23b60657db1ac84233
Bluetooth: Fix missing length checks for L2CAP signalling PDUs

commit cb3b3152b2f5939d67005cff841a1ca748b19888 upstream.

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>
net/bluetooth/l2cap_core.c