mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
Bluetooth: btrtl: Fix memory leak in rtlbt_parse_firmware_v2()
[ Upstream commit 1c21cf89a66413eb04b2d22c955b7a50edc14dfa ]
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: 9a24ce5e29 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
779f83a91d
commit
f44b8bbb1b
@@ -604,8 +604,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;
|
||||
|
||||
Reference in New Issue
Block a user