Bluetooth: Properly check L2CAP config option output buffer 36/150036/2
authorBen Seri <ben@armis.com>
Sat, 9 Sep 2017 21:15:59 +0000 (23:15 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Sep 2017 07:37:11 +0000 (16:37 +0900)
commit9f456718e3a337d4f96f3c4fcc1757621e728afe
treeaf9e338795aa06b2a8a83ea75ed3684bfd6eddc6
parent094dd19310707c481ed0a8057f79ebf252be5a97
Bluetooth: Properly check L2CAP config option output buffer

commit e860d2c904d1a9f38a24eb44c9f34b8f915a6ea3 upstream.

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

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[dh79.pyun: Cherry-pick from mainline to fix CVE-2017-1000251]
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Change-Id: Ia665b17aa7bfaa6ee13d652cce494da10b19b56d
net/bluetooth/l2cap_core.c