Bluetooth: Properly check L2CAP config option output buffer length
authorBen Seri <ben@armis.com>
Sat, 9 Sep 2017 21:15:59 +0000 (23:15 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Mon, 2 Oct 2017 18:52:32 +0000 (21:52 +0300)
commit483d316f28e1ece50975f3e34256d50b840406ec
treeb497354951b5b5b119792f1de3180e1447855898
parent23b8af2ab6456fb9cdf5c26258f91524d3f705ba
Bluetooth: Properly check L2CAP config option output buffer length

Validate the output buffer length for L2CAP config requests and responses
to avoid overflowing the stack buffer used for building the option blocks.

Cc: stable@vger.kernel.org
Signed-off-by: Ben Seri <ben@armis.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.2:
 - Drop changes to handling of L2CAP_CONF_EFS, L2CAP_CONF_EWS
 - Drop changes to l2cap_do_create(), l2cap_security_cfm(), and L2CAP_CONF_PENDING
   case in l2cap_config_rsp()
 - In l2cap_config_rsp(), s/buf/req/
 - Adjust context]
net/bluetooth/l2cap_core.c