diff options
author | Jesper Juhl <jj@chaosbits.net> | 2011-01-23 07:19:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-25 02:20:24 -0500 |
commit | 986e3f6e2b4582d9a7e61de5090042d5af85da44 (patch) | |
tree | 8f5f26ea8ae242c242b71d7a50c859852cee8cb5 /drivers/net/usb | |
parent | 2321f3b4afc7c017f34b0cad0624b3b9ebdf2ba4 (diff) |
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>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/kaweth.c | 1 |
1 files changed, 1 insertions, 0 deletions
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, | |||
406 | 406 | ||
407 | if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) { | 407 | if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) { |
408 | err("Firmware too big: %zu", fw->size); | 408 | err("Firmware too big: %zu", fw->size); |
409 | release_firmware(fw); | ||
409 | return -ENOSPC; | 410 | return -ENOSPC; |
410 | } | 411 | } |
411 | data_len = fw->size; | 412 | data_len = fw->size; |