[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231117112833.v2.2.I5f8211e201324f6d9f699e995fc59dda1e51f0ce@changeid>
Date: Fri, 17 Nov 2023 11:28:34 -0800
From: Manish Mandlik <mmandlik@...gle.com>
To: marcel@...tmann.org, luiz.dentz@...il.com
Cc: chromeos-bluetooth-upstreaming@...omium.org,
linux-bluetooth@...r.kernel.org,
Manish Mandlik <mmandlik@...gle.com>,
Johan Hedberg <johan.hedberg@...il.com>,
Tim Jiang <quic_tjiang@...cinc.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/2] Bluetooth: btusb: Fix double free in handle_dump_pkt_qca()
The hci_devcd_init() returns 0 on success. Do not use this return value
when eturning from handle_dump_pkt_qca() as it incorrectly indicates
that it's not a dump packet.
This causes the first dump skb to be processed by both hci_devcd_rx()
and hci_recv_frame() leading to double free.
Fixes: 20981ce2d5a5 ("Bluetooth: btusb: Add WCN6855 devcoredump support")
Signed-off-by: Manish Mandlik <mmandlik@...gle.com>
---
(no changes since v1)
drivers/bluetooth/btusb.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 35a26440cabd..d23c992502c5 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3531,10 +3531,11 @@ static int handle_dump_pkt_qca(struct hci_dev *hdev, struct sk_buff *skb)
goto out;
}
- ret = hci_devcd_init(hdev, dump_size);
- if (ret < 0) {
- bt_dev_err(hdev, "memdump init error(%d)", ret);
- goto out;
+ if (hci_devcd_init(hdev, dump_size) < 0) {
+ bt_dev_err(hdev, "memdump init error");
+ clear_bit(BTUSB_HW_SSR_ACTIVE, &btdata->flags);
+ kfree_skb(skb);
+ return ret;
}
btdata->qca_dump.ram_dump_size = dump_size;
--
2.43.0.rc0.421.g78406f8d94-goog
Powered by blists - more mailing lists