Skip to content

Commit

Permalink
USB NET KL5KUSB101: Fix mem leak in error path of kaweth_download_fir…
Browse files Browse the repository at this point in the history
…mware()

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>
  • Loading branch information
Jesper Juhl authored and David S. Miller committed Jan 25, 2011
1 parent 2321f3b commit 986e3f6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/usb/kaweth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 986e3f6

Please sign in to comment.