]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Bluetooth: RFCOMM: Fix not validating setsockopt user input
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 5 Apr 2024 19:43:45 +0000 (15:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 1 Feb 2025 17:24:01 +0000 (18:24 +0100)
commit00767fbd67af70d7a550caa5b12d9515fa978bab
treeec65bde2ebee51cdd25cde2a81c0d4992a0ce607
parent2c2dc87cdebef3fe3b9d7a711a984c70e376e32e
Bluetooth: RFCOMM: Fix not validating setsockopt user input

commit a97de7bff13b1cc825c1b1344eaed8d6c2d3e695 upstream.

syzbot reported rfcomm_sock_setsockopt_old() is copying data without
checking user input length.

BUG: KASAN: slab-out-of-bounds in copy_from_sockptr_offset
include/linux/sockptr.h:49 [inline]
BUG: KASAN: slab-out-of-bounds in copy_from_sockptr
include/linux/sockptr.h:55 [inline]
BUG: KASAN: slab-out-of-bounds in rfcomm_sock_setsockopt_old
net/bluetooth/rfcomm/sock.c:632 [inline]
BUG: KASAN: slab-out-of-bounds in rfcomm_sock_setsockopt+0x893/0xa70
net/bluetooth/rfcomm/sock.c:673
Read of size 4 at addr ffff8880209a8bc3 by task syz-executor632/5064

Fixes: 9f2c8a03fbb3 ("Bluetooth: Replace RFCOMM link mode with security level")
Fixes: bb23c0ab8246 ("Bluetooth: Add support for deferring RFCOMM connection setup")
Reported-by: syzbot <syzkaller@googlegroups.com>
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>
Signed-off-by: Keerthana K <keerthana.kalyanasundaram@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/bluetooth/rfcomm/sock.c