diff options
| author | Abdun Nihaal <nihaal@cse.iitm.ac.in> | 2025-10-28 23:26:30 +0530 |
|---|---|---|
| committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2025-10-31 12:42:47 -0400 |
| commit | 1c21cf89a66413eb04b2d22c955b7a50edc14dfa (patch) | |
| tree | 0ec9e46267841c1c41252b1183d1867b2c04d695 /drivers/bluetooth | |
| parent | Bluetooth: hci_event: validate skb length for unknown CC opcode (diff) | |
| download | linux-1c21cf89a66413eb04b2d22c955b7a50edc14dfa.tar.gz linux-1c21cf89a66413eb04b2d22c955b7a50edc14dfa.zip | |
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: 9a24ce5e29b1 ("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>
Diffstat (limited to 'drivers/bluetooth')
| -rw-r--r-- | drivers/bluetooth/btrtl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 6abd962502e3..1d4a7887abcc 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -625,8 +625,10 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, len += entry->len; } - if (!len) + if (!len) { + kvfree(ptr); return -EPERM; + } *_buf = ptr; return len; |
