Re: [syzbot] KASAN: slab-out-of-bounds Read in hci_le_meta_evt (2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/31/21 20:40, syzbot wrote:
Hello,

syzbot found the following issue on:

HEAD commit:    119c85055d86 Merge tag 'powerpc-5.15-6' of git://git.kerne..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1453e1f4b00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=6362530af157355b
dashboard link: https://syzkaller.appspot.com/bug?extid=e3fcb9c4f3c2a931dc40
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1128465cb00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1431dfe2b00000

Bisection is inconclusive: the issue happens on the oldest tested release.

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=10f27096b00000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=12f27096b00000
console output: https://syzkaller.appspot.com/x/log.txt?x=14f27096b00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+e3fcb9c4f3c2a931dc40@xxxxxxxxxxxxxxxxxxxxxxxxx

Bluetooth: hci0: unknown advertising packet type: 0x90
Bluetooth: hci0: Dropping invalid advertising data


If packet has invalid length we should check if we won't go beyond skb->tail on next iteration.


#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master




With regards,
Pavel Skripkin

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 0bca035bf2dc..3e294584aa7c 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5790,6 +5790,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
 		}
 
 		ptr += sizeof(*ev) + ev->length + 1;
+
+		if (ptr >= (void *) skb_tail_pointer(skb)) {
+			bt_dev_err(hdev, "Malicious advertising data. Stopping processing");
+			break;
+		}
 	}
 
 	hci_dev_unlock(hdev);

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux