From: Abdun Nihaal Date: Tue, 28 Oct 2025 17:56:30 +0000 (+0530) Subject: Bluetooth: btrtl: Fix memory leak in rtlbt_parse_firmware_v2() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c21cf89a66413eb04b2d22c955b7a50edc14dfa;p=thirdparty%2Flinux.git 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 Signed-off-by: Luiz Augusto von Dentz --- 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;