All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.4/5.10/5.15] Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
@ 2023-02-01 10:24 Ovidiu Panait
  2023-02-03  8:13 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Ovidiu Panait @ 2023-02-01 10:24 UTC (permalink / raw)
  To: stable; +Cc: Soenke Huster, Luiz Augusto von Dentz, Ovidiu Panait

From: Soenke Huster <soenke.huster@eknoes.de>

commit 3afee2118132e93e5f6fa636dfde86201a860ab3 upstream.

This event is just specified for SCO and eSCO link types.
On the reception of a HCI_Synchronous_Connection_Complete for a BDADDR
of an existing LE connection, LE link type and a status that triggers the
second case of the packet processing a NULL pointer dereference happens,
as conn->link is NULL.

Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
---
This fixes "BUG: KASAN: use-after-free in sco_chan_del()" issue detected while
fuzzing with syzkaller.

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

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 57bf05253e04..685f89516e1e 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4116,6 +4116,19 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,
 	struct hci_ev_sync_conn_complete *ev = (void *) skb->data;
 	struct hci_conn *conn;
 
+	switch (ev->link_type) {
+	case SCO_LINK:
+	case ESCO_LINK:
+		break;
+	default:
+		/* As per Core 5.3 Vol 4 Part E 7.7.35 (p.2219), Link_Type
+		 * for HCI_Synchronous_Connection_Complete is limited to
+		 * either SCO or eSCO
+		 */
+		bt_dev_err(hdev, "Ignoring connect complete event for invalid link type");
+		return;
+	}
+
 	BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
 
 	hci_dev_lock(hdev);
-- 
2.23.0


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

* Re: [PATCH 5.4/5.10/5.15] Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
  2023-02-01 10:24 [PATCH 5.4/5.10/5.15] Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt Ovidiu Panait
@ 2023-02-03  8:13 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2023-02-03  8:13 UTC (permalink / raw)
  To: Ovidiu Panait; +Cc: stable, Soenke Huster, Luiz Augusto von Dentz

On Wed, Feb 01, 2023 at 12:24:56PM +0200, Ovidiu Panait wrote:
> From: Soenke Huster <soenke.huster@eknoes.de>
> 
> commit 3afee2118132e93e5f6fa636dfde86201a860ab3 upstream.
> 
> This event is just specified for SCO and eSCO link types.
> On the reception of a HCI_Synchronous_Connection_Complete for a BDADDR
> of an existing LE connection, LE link type and a status that triggers the
> second case of the packet processing a NULL pointer dereference happens,
> as conn->link is NULL.
> 
> Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com>
> ---
> This fixes "BUG: KASAN: use-after-free in sco_chan_del()" issue detected while
> fuzzing with syzkaller.

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2023-02-03  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 10:24 [PATCH 5.4/5.10/5.15] Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt Ovidiu Panait
2023-02-03  8:13 ` Greg KH

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.