On Thu, 04 Apr 2024 23:55:25 -0700
> syzbot found the following issue on:
>
> HEAD commit: 707081b61156 Merge branch 'for-next/core', remote-tracking..
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15c6098d180000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e
--- x/net/bluetooth/l2cap_sock.c
+++ y/net/bluetooth/l2cap_sock.c
@@ -960,7 +960,7 @@ static int l2cap_sock_setsockopt(struct
break;
}
- if (copy_from_sockptr(&opt, optval, sizeof(u32))) {
+ if (optlen < sizeof(u32) || copy_from_sockptr(&opt, optval, sizeof(u32))) {
err = -EFAULT;
break;
}
--
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: [email protected]
Tested on:
commit: fe46a7dd Merge tag 'sound-6.9-rc1' of git://git.kernel..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=136840bd180000
kernel config: https://syzkaller.appspot.com/x/.config?x=66b62423625ca66a
dashboard link: https://syzkaller.appspot.com/bug?extid=8a1d152fba6b41f760ae
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=13d15f19180000
Note: testing is done by a robot and is best-effort only.