All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	skhan@linuxfoundation.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] Bluetooth: skip invalid hci_sync_conn_complete_evt
Date: Thu, 29 Jul 2021 13:38:50 +0200	[thread overview]
Message-ID: <72819085-5564-4386-AD94-2901083CDE65@holtmann.org> (raw)
In-Reply-To: <20210728075105.415214-1-desmondcheongzx@gmail.com>

Hi Desmond,

> Syzbot reported a corrupted list in kobject_add_internal [1]. This
> happens when multiple HCI_EV_SYNC_CONN_COMPLETE event packets with
> status 0 are sent for the same HCI connection. This causes us to
> register the device more than once which corrupts the kset list.
> 
> As this is forbidden behavior, we add a check for whether we're
> trying to process the same HCI_EV_SYNC_CONN_COMPLETE event multiple
> times for one connection. If that's the case, the event is invalid, so
> we report an error that the device is misbehaving, and ignore the
> packet.
> 
> Link: https://syzkaller.appspot.com/bug?extid=66264bf2fd0476be7e6c [1]
> Reported-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com
> Tested-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com
> Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> ---
> 
> v1 -> v2:
> - Added more comments to explain the reasoning behind the new check, and
> a bt_dev_err message upon detecting the invalid event. As suggested by
> Marcel Holtmann.
> 
> net/bluetooth/hci_event.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)

I shortened the error message and then applied your patch to bluetooth-next tree.

Regards

Marcel


WARNING: multiple messages have this Message-ID (diff)
From: Marcel Holtmann <marcel@holtmann.org>
To: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	"open list:NETWORKING \[GENERAL\]" <netdev@vger.kernel.org>,
	syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com,
	open list <linux-kernel@vger.kernel.org>,
	linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2] Bluetooth: skip invalid hci_sync_conn_complete_evt
Date: Thu, 29 Jul 2021 13:38:50 +0200	[thread overview]
Message-ID: <72819085-5564-4386-AD94-2901083CDE65@holtmann.org> (raw)
In-Reply-To: <20210728075105.415214-1-desmondcheongzx@gmail.com>

Hi Desmond,

> Syzbot reported a corrupted list in kobject_add_internal [1]. This
> happens when multiple HCI_EV_SYNC_CONN_COMPLETE event packets with
> status 0 are sent for the same HCI connection. This causes us to
> register the device more than once which corrupts the kset list.
> 
> As this is forbidden behavior, we add a check for whether we're
> trying to process the same HCI_EV_SYNC_CONN_COMPLETE event multiple
> times for one connection. If that's the case, the event is invalid, so
> we report an error that the device is misbehaving, and ignore the
> packet.
> 
> Link: https://syzkaller.appspot.com/bug?extid=66264bf2fd0476be7e6c [1]
> Reported-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com
> Tested-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com
> Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
> ---
> 
> v1 -> v2:
> - Added more comments to explain the reasoning behind the new check, and
> a bt_dev_err message upon detecting the invalid event. As suggested by
> Marcel Holtmann.
> 
> net/bluetooth/hci_event.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)

I shortened the error message and then applied your patch to bluetooth-next tree.

Regards

Marcel

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  parent reply	other threads:[~2021-07-29 11:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  7:51 [PATCH v2] Bluetooth: skip invalid hci_sync_conn_complete_evt Desmond Cheong Zhi Xi
2021-07-28  7:51 ` Desmond Cheong Zhi Xi
2021-07-28  9:07 ` [v2] " bluez.test.bot
2021-07-29 11:38 ` Marcel Holtmann [this message]
2021-07-29 11:38   ` [PATCH v2] " Marcel Holtmann

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=72819085-5564-4386-AD94-2901083CDE65@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=davem@davemloft.net \
    --cc=desmondcheongzx@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.