mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.com>,
	davem@davemloft.net, johan.hedberg@gmail.com, kuba@kernel.org,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	luiz.dentz@gmail.com, marcel@holtmann.org,
	netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] KASAN: slab-out-of-bounds Read in hci_le_meta_evt (2)
Date: Sun, 31 Oct 2021 21:21:48 +0300	[thread overview]
Message-ID: <dd579644-7ef9-f005-0275-b7384ca731a5@gmail.com> (raw)
In-Reply-To: <00000000000035de5905cfa98e03@google.com>

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

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@syzkaller.appspotmail.com
> 
> 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


[-- Attachment #2: ph --]
[-- Type: text/plain, Size: 487 bytes --]

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

  reply	other threads:[~2021-10-31 18:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31 17:40 syzbot
2021-10-31 18:21 ` Pavel Skripkin [this message]
2021-10-31 18:49   ` syzbot
2021-10-31 20:16     ` Pavel Skripkin
2021-11-01  0:10       ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dd579644-7ef9-f005-0275-b7384ca731a5@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+e3fcb9c4f3c2a931dc40@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®