linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_qca: Fix memleak in qca_controller_memdump
@ 2021-01-02  5:47 Dinghao Liu
  2021-01-06  7:50 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2021-01-02  5:47 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	Venkata Lakshmi Narayana Gubba, Balakrishna Godavarthi,
	linux-bluetooth, linux-kernel

When __le32_to_cpu() fails, qca_memdump should be freed
just like when vmalloc() fails.

Fixes: d841502c79e3f ("Bluetooth: hci_qca: Collect controller memory dump during SSR")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/bluetooth/hci_qca.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4a963682c702..5dbcb7c42b80 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1024,7 +1024,9 @@ static void qca_controller_memdump(struct work_struct *work)
 			dump_size = __le32_to_cpu(dump->dump_size);
 			if (!(dump_size)) {
 				bt_dev_err(hu->hdev, "Rx invalid memdump size");
+				kfree(qca_memdump);
 				kfree_skb(skb);
+				qca->qca_memdump = NULL;
 				mutex_unlock(&qca->hci_memdump_lock);
 				return;
 			}
-- 
2.17.1


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

* Re: [PATCH] Bluetooth: hci_qca: Fix memleak in qca_controller_memdump
  2021-01-02  5:47 [PATCH] Bluetooth: hci_qca: Fix memleak in qca_controller_memdump Dinghao Liu
@ 2021-01-06  7:50 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2021-01-06  7:50 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Johan Hedberg, Luiz Augusto von Dentz,
	Venkata Lakshmi Narayana Gubba, Balakrishna Godavarthi,
	linux-bluetooth, linux-kernel

Hi Dinghao,

> When __le32_to_cpu() fails, qca_memdump should be freed
> just like when vmalloc() fails.
> 
> Fixes: d841502c79e3f ("Bluetooth: hci_qca: Collect controller memory dump during SSR")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/bluetooth/hci_qca.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2021-01-06  7:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-02  5:47 [PATCH] Bluetooth: hci_qca: Fix memleak in qca_controller_memdump Dinghao Liu
2021-01-06  7:50 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).