All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan+linaro@kernel.org>
To: Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Zhengping Jiang <jiangzp@google.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan+linaro@kernel.org>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] Bluetooth: qca: fix NULL-deref on non-serdev suspend
Date: Tue, 19 Mar 2024 16:46:10 +0100	[thread overview]
Message-ID: <20240319154611.2492-2-johan+linaro@kernel.org> (raw)
In-Reply-To: <20240319154611.2492-1-johan+linaro@kernel.org>

Qualcomm ROME controllers can be registered from the Bluetooth line
discipline and in this case the HCI UART serdev pointer is NULL.

Add the missing sanity check to prevent a NULL-pointer dereference when
wakeup() is called for a non-serdev controller during suspend.

Just return true for now to restore the original behaviour and address
the crash with pre-6.2 kernels, which do not have commit e9b3e5b8c657
("Bluetooth: hci_qca: only assign wakeup with serial port support") that
causes the crash to happen already at setup() time.

Fixes: c1a74160eaf1 ("Bluetooth: hci_qca: Add device_may_wakeup support")
Cc: stable@vger.kernel.org      # 5.13
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/bluetooth/hci_qca.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index c73481c57741..84f728943962 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1672,6 +1672,9 @@ static bool qca_wakeup(struct hci_dev *hdev)
 	struct hci_uart *hu = hci_get_drvdata(hdev);
 	bool wakeup;
 
+	if (!hu->serdev)
+		return true;
+
 	/* BT SoC attached through the serial bus is handled by the serdev driver.
 	 * So we need to use the device handle of the serdev driver to get the
 	 * status of device may wakeup.
-- 
2.43.2


  reply	other threads:[~2024-03-19 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 15:46 [PATCH 0/2] Bluetooth: qca: fix NULL-deref on non-serdev setup Johan Hovold
2024-03-19 15:46 ` Johan Hovold [this message]
2024-03-19 16:35   ` bluez.test.bot
2024-03-19 15:46 ` [PATCH 2/2] " Johan Hovold
2024-04-22 12:51 ` [PATCH 0/2] " Johan Hovold
2024-04-22 13:04   ` quic_zijuhu
2024-04-22 13:20     ` Johan Hovold
2024-04-22 13:30       ` quic_zijuhu
2024-04-22 13:43         ` Johan Hovold
2024-04-22 13:53           ` quic_zijuhu
2024-04-22 14:15             ` Luiz Augusto von Dentz
2024-04-22 14:22               ` quic_zijuhu
2024-04-22 15:02             ` Johan Hovold
2024-04-22 15:19               ` quic_zijuhu
2024-04-22 13:44       ` Luiz Augusto von Dentz
2024-04-22 13:51         ` Johan Hovold
2024-04-22 13:52           ` Luiz Augusto von Dentz

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=20240319154611.2492-2-johan+linaro@kernel.org \
    --to=johan+linaro@kernel.org \
    --cc=jiangzp@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=stable@vger.kernel.org \
    /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.