* [PATCH v1] bluetooth: hci_qca: Fix suspend/resume functionality failure
@ 2020-05-28 10:38 Zijun Hu
2020-05-28 16:16 ` Matthias Kaehlcke
0 siblings, 1 reply; 2+ messages in thread
From: Zijun Hu @ 2020-05-28 10:38 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, bgodavar, c-hbandi,
hemantg, mka, rjliao, zijuhu
@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.
Signed-off-by: Zijun Hu <zijuhu@codeaurora.org>
---
drivers/bluetooth/hci_qca.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index e4a6823..c159161 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1977,8 +1977,10 @@ 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 hci_dev *hdev __maybe_unused = hu->hdev;
struct qca_data *qca = hu->priv;
unsigned long flags;
int ret = 0;
@@ -2057,8 +2059,10 @@ static int __maybe_unused qca_suspend(struct device *dev)
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 hci_dev *hdev __maybe_unused = hu->hdev;
struct qca_data *qca = hu->priv;
clear_bit(QCA_SUSPENDING, &qca->flags);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] bluetooth: hci_qca: Fix suspend/resume functionality failure
2020-05-28 10:38 [PATCH v1] bluetooth: hci_qca: Fix suspend/resume functionality failure Zijun Hu
@ 2020-05-28 16:16 ` Matthias Kaehlcke
0 siblings, 0 replies; 2+ messages in thread
From: Matthias Kaehlcke @ 2020-05-28 16:16 UTC (permalink / raw)
To: Zijun Hu
Cc: marcel, johan.hedberg, linux-kernel, linux-bluetooth,
linux-arm-msm, bgodavar, c-hbandi, hemantg, rjliao
Hi Zijun,
On Thu, May 28, 2020 at 06:38:22PM +0800, Zijun Hu wrote:
> @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.
>
> Signed-off-by: Zijun Hu <zijuhu@codeaurora.org>
Please add:
Fixes: 41d5b25fed0 ("Bluetooth: hci_qca: add PM support")
and add stable@kernel.org to cc:
> ---
> drivers/bluetooth/hci_qca.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index e4a6823..c159161 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1977,8 +1977,10 @@ 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 hci_dev *hdev __maybe_unused = hu->hdev;
hdev is not used, please remove
> struct qca_data *qca = hu->priv;
> unsigned long flags;
> int ret = 0;
> @@ -2057,8 +2059,10 @@ static int __maybe_unused qca_suspend(struct device *dev)
>
> 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 hci_dev *hdev __maybe_unused = hu->hdev;
hdev is not used, please remove
> struct qca_data *qca = hu->priv;
>
> clear_bit(QCA_SUSPENDING, &qca->flags);
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-28 16:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 10:38 [PATCH v1] bluetooth: hci_qca: Fix suspend/resume functionality failure Zijun Hu
2020-05-28 16:16 ` Matthias Kaehlcke
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.