mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
USB NET KL5KUSB101: Fix mem leak in error path of kaweth_download_firmware()
We will leak the storage allocated by request_firmware() if the size of the firmware is greater than KAWETH_FIRMWARE_BUF_SIZE. This removes the leak by calling release_firmware() before we return -ENOSPC. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2321f3b4af
commit
986e3f6e2b
1 changed files with 1 additions and 0 deletions
|
@ -406,6 +406,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
|
|||
|
||||
if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) {
|
||||
err("Firmware too big: %zu", fw->size);
|
||||
release_firmware(fw);
|
||||
return -ENOSPC;
|
||||
}
|
||||
data_len = fw->size;
|
||||
|
|
Loading…
Reference in a new issue