2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-25 05:34:00 +08:00

staging: vt6656: Fix possible leak in vnt_download_firmware()

When failing to allocate buffer memory, function vnt_download_firmware() goes
through the wrong exit path and fails to release the already requested
firmware. Thus use the correct cleanup. Detected by Coverity CID 1269128.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Reviewed-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Christian Engelmayer 2015-02-11 20:33:15 +01:00 committed by Greg Kroah-Hartman
parent 6498613d2c
commit d34add0594

View File

@ -61,7 +61,7 @@ int vnt_download_firmware(struct vnt_private *priv)
buffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL);
if (!buffer)
goto out;
goto free_fw;
for (ii = 0; ii < fw->size; ii += FIRMWARE_CHUNK_SIZE) {
length = min_t(int, fw->size - ii, FIRMWARE_CHUNK_SIZE);