* [PATCH] Bluetooth: fix oob in hci_sock_setsockopt
[not found] <0000000000007558ae061553f41b@google.com>
@ 2024-04-09 13:42 ` Edward Adam Davis
2024-04-09 14:13 ` Luiz Augusto von Dentz
2024-05-08 1:11 ` [syzbot] [bluetooth?] KASAN: slab-out-of-bounds Read " syzbot
1 sibling, 1 reply; 3+ messages in thread
From: Edward Adam Davis @ 2024-04-09 13:42 UTC (permalink / raw)
To: syzbot+837ba09d9db969068367
Cc: johan.hedberg, linux-bluetooth, linux-kernel, luiz.dentz, marcel,
syzkaller-bugs, netdev
If len < sizeof(opt) it will trigger oob, so take the min of them.
Reported-by: syzbot+837ba09d9db969068367@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
net/bluetooth/hci_sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 4ee1b976678b..cee7ec1adbd2 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1946,7 +1946,7 @@ static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname,
switch (optname) {
case HCI_DATA_DIR:
- if (copy_from_sockptr(&opt, optval, sizeof(opt))) {
+ if (copy_from_sockptr(&opt, optval, min_t(int, sizeof(opt), len))) {
err = -EFAULT;
break;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: fix oob in hci_sock_setsockopt
2024-04-09 13:42 ` [PATCH] Bluetooth: fix oob in hci_sock_setsockopt Edward Adam Davis
@ 2024-04-09 14:13 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-09 14:13 UTC (permalink / raw)
To: Edward Adam Davis
Cc: syzbot+837ba09d9db969068367, johan.hedberg, linux-bluetooth,
linux-kernel, marcel, syzkaller-bugs, netdev
Hi Edward,
On Tue, Apr 9, 2024 at 9:42 AM Edward Adam Davis <eadavis@qq.com> wrote:
>
> If len < sizeof(opt) it will trigger oob, so take the min of them.
>
> Reported-by: syzbot+837ba09d9db969068367@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> net/bluetooth/hci_sock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
> index 4ee1b976678b..cee7ec1adbd2 100644
> --- a/net/bluetooth/hci_sock.c
> +++ b/net/bluetooth/hci_sock.c
> @@ -1946,7 +1946,7 @@ static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname,
>
> switch (optname) {
> case HCI_DATA_DIR:
> - if (copy_from_sockptr(&opt, optval, sizeof(opt))) {
> + if (copy_from_sockptr(&opt, optval, min_t(int, sizeof(opt), len))) {
> err = -EFAULT;
> break;
> }
> --
> 2.43.0
https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=35d2c39b23fffa3d5a216142cc51d86354024363
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: slab-out-of-bounds Read in hci_sock_setsockopt
[not found] <0000000000007558ae061553f41b@google.com>
2024-04-09 13:42 ` [PATCH] Bluetooth: fix oob in hci_sock_setsockopt Edward Adam Davis
@ 2024-05-08 1:11 ` syzbot
1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2024-05-08 1:11 UTC (permalink / raw)
To: andrii, ast, eadavis, hdanton, johan.hedberg, jolsa, laoar.shao,
linux-bluetooth, linux-kernel, luiz.dentz, marcel, netdev,
syzkaller-bugs, yonghong.song
syzbot has bisected this issue to:
commit 3505cb9fa26cfec9512744466e754a8cbc2365b0
Author: Jiri Olsa <jolsa@kernel.org>
Date: Wed Aug 9 08:34:14 2023 +0000
bpf: Add attach_type checks under bpf_prog_attach_check_attach_type
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=158aedbc980000
start commit: fe46a7dd189e Merge tag 'sound-6.9-rc1' of git://git.kernel..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=178aedbc980000
console output: https://syzkaller.appspot.com/x/log.txt?x=138aedbc980000
kernel config: https://syzkaller.appspot.com/x/.config?x=4d90a36f0cab495a
dashboard link: https://syzkaller.appspot.com/bug?extid=837ba09d9db969068367
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15807005180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1777929d180000
Reported-by: syzbot+837ba09d9db969068367@syzkaller.appspotmail.com
Fixes: 3505cb9fa26c ("bpf: Add attach_type checks under bpf_prog_attach_check_attach_type")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-08 1:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <0000000000007558ae061553f41b@google.com>
2024-04-09 13:42 ` [PATCH] Bluetooth: fix oob in hci_sock_setsockopt Edward Adam Davis
2024-04-09 14:13 ` Luiz Augusto von Dentz
2024-05-08 1:11 ` [syzbot] [bluetooth?] KASAN: slab-out-of-bounds Read " syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).