[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_D423A78448F764177A26CAB3716365096705@qq.com>
Date: Tue, 9 Apr 2024 21:49:12 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+b71011ec0a23f4d15625@...kaller.appspotmail.com
Cc: johan.hedberg@...il.com,
linux-bluetooth@...r.kernel.org,
linux-kernel@...r.kernel.org,
luiz.dentz@...il.com,
marcel@...tmann.org,
netdev@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] Bluetooth: fix oob in sco_sock_setsockopt
If optlen < sizeof(u32) it will trigger oob, so take the min of them.
Reported-by: syzbot+b71011ec0a23f4d15625@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
net/bluetooth/sco.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 43daf965a01e..815646d9e72b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -890,7 +890,7 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname,
break;
case BT_PKT_STATUS:
- if (copy_from_sockptr(&opt, optval, sizeof(u32))) {
+ if (copy_from_sockptr(&opt, optval, min_t(int, sizeof(u32), optlen))) {
err = -EFAULT;
break;
}
--
2.43.0
Powered by blists - more mailing lists