Bluetooth: L2CAP: Fix not validating setsockopt user input
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 5 Apr 2024 19:50:47 +0000 (15:50 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2024 09:18:25 +0000 (11:18 +0200)
commit9d42f373391211c7c8af66a3a316533a32b8a607
tree66d8118d156761f2cc2b90d47583ff4d666d1af3
parent7bc65d23ba20dcd7ecc094a12c181e594e5eb315
Bluetooth: L2CAP: Fix not validating setsockopt user input

[ Upstream commit 4f3951242ace5efc7131932e2e01e6ac6baed846 ]

Check user input length before copying data.

Fixes: 33575df7be67 ("Bluetooth: move l2cap_sock_setsockopt() to l2cap_sock.c")
Fixes: 3ee7b7cd8390 ("Bluetooth: Add BT_MODE socket option")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/l2cap_sock.c