]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
Bluetooth: hci_qca: Fix suspend/resume functionality failure
authorZijun Hu <zijuhu@codeaurora.org>
Thu, 28 May 2020 20:31:07 +0000 (04:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:32:26 +0000 (09:32 +0200)
[ Upstream commit feac90d756c03b03b83fabe83571bd88ecc96b78 ]

@dev parameter of qca_suspend()/qca_resume() represents
serdev_device, but it is mistook for hci_dev and causes
succedent unexpected memory access.

Fix by taking @dev as serdev_device.

Fixes: 41d5b25fed0 ("Bluetooth: hci_qca: add PM support")
Signed-off-by: Zijun Hu <zijuhu@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bluetooth/hci_qca.c

index 439392b1c043c5a97b1ce82726ead6a451b61cd4..0b1036e5e963c5f7d44b6f0b56989720cba272dd 100644 (file)
@@ -1953,8 +1953,9 @@ static void qca_serdev_remove(struct serdev_device *serdev)
 
 static int __maybe_unused qca_suspend(struct device *dev)
 {
-       struct hci_dev *hdev = container_of(dev, struct hci_dev, dev);
-       struct hci_uart *hu = hci_get_drvdata(hdev);
+       struct serdev_device *serdev = to_serdev_device(dev);
+       struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
+       struct hci_uart *hu = &qcadev->serdev_hu;
        struct qca_data *qca = hu->priv;
        unsigned long flags;
        int ret = 0;
@@ -2033,8 +2034,9 @@ error:
 
 static int __maybe_unused qca_resume(struct device *dev)
 {
-       struct hci_dev *hdev = container_of(dev, struct hci_dev, dev);
-       struct hci_uart *hu = hci_get_drvdata(hdev);
+       struct serdev_device *serdev = to_serdev_device(dev);
+       struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
+       struct hci_uart *hu = &qcadev->serdev_hu;
        struct qca_data *qca = hu->priv;
 
        clear_bit(QCA_SUSPENDING, &qca->flags);