Commit 365af7ac authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Luiz Augusto von Dentz says:

====================
bluetooth pull request for net:

 - Bluetooth: Fix TOCTOU in HCI debugfs implementation
 - Bluetooth: hci_event: set the conn encrypted before conn establishes
 - Bluetooth: qca: fix device-address endianness
 - Bluetooth: hci_sync: Fix not checking error on hci_cmd_sync_cancel_sync

* tag 'for-net-2024-03-29' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
  Bluetooth: Fix TOCTOU in HCI debugfs implementation
  Bluetooth: hci_event: set the conn encrypted before conn establishes
  Bluetooth: hci_sync: Fix not checking error on hci_cmd_sync_cancel_sync
  Bluetooth: qca: fix device-address endianness
  Bluetooth: add quirk for broken address properties
  arm64: dts: qcom: sc7180-trogdor: mark bluetooth address as broken
  dt-bindings: bluetooth: add 'qcom,local-bd-address-broken'
  Revert "Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT"
====================

Link: https://lore.kernel.org/r/20240329140453.2016486-1-luiz.dentz@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents ec7ef3ea 7835fcfd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -94,6 +94,10 @@ properties:

  local-bd-address: true

  qcom,local-bd-address-broken:
    type: boolean
    description:
      boot firmware is incorrectly passing the address in big-endian order

required:
  - compatible
+2 −0
Original line number Diff line number Diff line
@@ -944,6 +944,8 @@ bluetooth: bluetooth {
		vddrf-supply = <&pp1300_l2c>;
		vddch0-supply = <&pp3300_l10c>;
		max-speed = <3200000>;

		qcom,local-bd-address-broken;
	};
};

+6 −2
Original line number Diff line number Diff line
@@ -826,11 +826,15 @@ EXPORT_SYMBOL_GPL(qca_uart_setup);

int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
{
	bdaddr_t bdaddr_swapped;
	struct sk_buff *skb;
	int err;

	skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6, bdaddr,
				HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
	baswap(&bdaddr_swapped, bdaddr);

	skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6,
				&bdaddr_swapped, HCI_EV_VENDOR,
				HCI_INIT_TIMEOUT);
	if (IS_ERR(skb)) {
		err = PTR_ERR(skb);
		bt_dev_err(hdev, "QCA Change address cmd failed (%d)", err);
+9 −10
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
 *
 *  Copyright (C) 2007 Texas Instruments, Inc.
 *  Copyright (c) 2010, 2012, 2018 The Linux Foundation. All rights reserved.
 *  Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 *  Acknowledgements:
 *  This file is based on hci_ll.c, which was...
@@ -226,6 +225,7 @@ struct qca_serdev {
	struct qca_power *bt_power;
	u32 init_speed;
	u32 oper_speed;
	bool bdaddr_property_broken;
	const char *firmware_name;
};

@@ -1843,6 +1843,7 @@ static int qca_setup(struct hci_uart *hu)
	const char *firmware_name = qca_get_firmware_name(hu);
	int ret;
	struct qca_btsoc_version ver;
	struct qca_serdev *qcadev;
	const char *soc_name;

	ret = qca_check_speeds(hu);
@@ -1904,16 +1905,11 @@ static int qca_setup(struct hci_uart *hu)
	case QCA_WCN6750:
	case QCA_WCN6855:
	case QCA_WCN7850:

		/* Set BDA quirk bit for reading BDA value from fwnode property
		 * only if that property exist in DT.
		 */
		if (fwnode_property_present(dev_fwnode(hdev->dev.parent), "local-bd-address")) {
		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
			bt_dev_info(hdev, "setting quirk bit to read BDA from fwnode later");
		} else {
			bt_dev_dbg(hdev, "local-bd-address` is not present in the devicetree so not setting quirk bit for BDA");
		}

		qcadev = serdev_device_get_drvdata(hu->serdev);
		if (qcadev->bdaddr_property_broken)
			set_bit(HCI_QUIRK_BDADDR_PROPERTY_BROKEN, &hdev->quirks);

		hci_set_aosp_capable(hdev);

@@ -2295,6 +2291,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
	if (!qcadev->oper_speed)
		BT_DBG("UART will pick default operating speed");

	qcadev->bdaddr_property_broken = device_property_read_bool(&serdev->dev,
			"qcom,local-bd-address-broken");

	if (data)
		qcadev->btsoc_type = data->soc_type;
	else
+9 −0
Original line number Diff line number Diff line
@@ -176,6 +176,15 @@ enum {
	 */
	HCI_QUIRK_USE_BDADDR_PROPERTY,

	/* When this quirk is set, the Bluetooth Device Address provided by
	 * the 'local-bd-address' fwnode property is incorrectly specified in
	 * big-endian order.
	 *
	 * This quirk can be set before hci_register_dev is called or
	 * during the hdev->setup vendor callback.
	 */
	HCI_QUIRK_BDADDR_PROPERTY_BROKEN,

	/* When this quirk is set, the duplicate filtering during
	 * scanning is based on Bluetooth devices addresses. To allow
	 * RSSI based updates, restart scanning if needed.
Loading