netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/bluetooth: Fix bound check in event handling
@ 2019-02-28 19:59 Tomas Bortoli
  2019-03-02 16:46 ` Marcel Holtmann
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Tomas Bortoli @ 2019-02-28 19:59 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: davem, linux-bluetooth, netdev, linux-kernel, syzkaller,
	Tomas Bortoli

hci_inquiry_result_with_rssi_evt() can perform out of bound reads
on skb->data as a bound check is missing.

Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+cec7a50c412a2c03f8f5@syzkaller.appspotmail.com
Reported-by: syzbot+660883c56e2fa65d4497@syzkaller.appspotmail.com
---
Syzkaler reports:
https://syzkaller.appspot.com/bug?id=d708485af9edc3af35f3b4d554e827c6c8bf6b0f
https://syzkaller.appspot.com/bug?id=3acd1155d48a5acc5d76711568b04926945a6885

 net/bluetooth/hci_event.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ac2826ce162b..aa953d23bb72 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3983,6 +3983,10 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev,
 		for (; num_rsp; num_rsp--, info++) {
 			u32 flags;
 
+			if ((void *)(info + sizeof(info)) >
+			   (void *)(skb->data + skb->len))
+				break;
+
 			bacpy(&data.bdaddr, &info->bdaddr);
 			data.pscan_rep_mode	= info->pscan_rep_mode;
 			data.pscan_period_mode	= info->pscan_period_mode;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-30 22:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-28 19:59 [PATCH] net/bluetooth: Fix bound check in event handling Tomas Bortoli
2019-03-02 16:46 ` Marcel Holtmann
2019-03-02 23:17   ` Tomas Bortoli
2019-03-04 15:04 ` Dan Carpenter
2019-03-04 19:58   ` Tomas Bortoli
2019-03-04 20:20 ` Tomas Bortoli
2019-03-30  7:17 ` Dan Carpenter
2019-03-30  8:23   ` [kbuild] " Dan Carpenter
2019-03-30 22:37   ` Tomas Bortoli

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).