Skip to content

Commit 986e3f6

Browse files
jjuhldavem330
authored andcommitted
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>
1 parent 2321f3b commit 986e3f6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/usb/kaweth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
406406

407407
if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) {
408408
err("Firmware too big: %zu", fw->size);
409+
release_firmware(fw);
409410
return -ENOSPC;
410411
}
411412
data_len = fw->size;

0 commit comments

Comments
 (0)