summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/btmtk.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-02-28 19:17:24 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-03-07 01:26:23 +0300
commit79f4127a502c5905f04da1f20a7bbe07103fb77c (patch)
tree3f3ba4d8ffd080adc190ec940a7d4fb6c4b0ea8b /drivers/bluetooth/btmtk.c
parenta6e06258f4c31eba0fcd503e19828b5f8fe7b08b (diff)
downloadlinux-79f4127a502c5905f04da1f20a7bbe07103fb77c.tar.xz
Bluetooth: btusb: Fix memory leak
This checks if CONFIG_DEV_COREDUMP is enabled before attempting to clone the skb and also make sure btmtk_process_coredump frees the skb passed following the same logic. Fixes: 0b7015132878 ("Bluetooth: btusb: mediatek: add MediaTek devcoredump support") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'drivers/bluetooth/btmtk.c')
-rw-r--r--drivers/bluetooth/btmtk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index aaabb732082c..285418dbb43f 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -372,8 +372,10 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
struct btmediatek_data *data = hci_get_priv(hdev);
int err;
- if (!IS_ENABLED(CONFIG_DEV_COREDUMP))
+ if (!IS_ENABLED(CONFIG_DEV_COREDUMP)) {
+ kfree_skb(skb);
return 0;
+ }
switch (data->cd_info.state) {
case HCI_DEVCOREDUMP_IDLE: