From: Jesper Juhl Date: Sun, 23 Jan 2011 12:19:55 +0000 (+0000) Subject: USB NET KL5KUSB101: Fix mem leak in error path of kaweth_download_firmware() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=986e3f6e2b4582d9a7e61de5090042d5af85da44;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 5e98643a4a21..7dc84971f26f 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c @@ -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;