]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
Bluetooth: hci_qca: Fix memleak in qca_controller_memdump
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sat, 2 Jan 2021 05:47:55 +0000 (13:47 +0800)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Mar 2021 14:08:52 +0000 (15:08 +0100)
[ Upstream commit 71f8e707557b9bc25dc90a59a752528d4e7c1cbf ]

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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/bluetooth/hci_qca.c

index 4a963682c70215d1b9274e1ff495c7c544463b6e..5dbcb7c42b80530ff56547e8ba55bff796b3c509 100644 (file)
@@ -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;
                        }