Skip to content

Commit 1c21cf8

Browse files
Abdun NihaalVudentz
authored andcommitted
Bluetooth: btrtl: Fix memory leak in rtlbt_parse_firmware_v2()
The memory allocated for ptr using kvmalloc() is not freed on the last error path. Fix that by freeing it on that error path. Fixes: 9a24ce5 ("Bluetooth: btrtl: Firmware format v2 support") Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent 5c5f1f6 commit 1c21cf8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/bluetooth/btrtl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,10 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
625625
len += entry->len;
626626
}
627627

628-
if (!len)
628+
if (!len) {
629+
kvfree(ptr);
629630
return -EPERM;
631+
}
630632

631633
*_buf = ptr;
632634
return len;

0 commit comments

Comments
 (0)