Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christian Engelmayer and committed by
Greg Kroah-Hartman
d34add05 6498613d

+1 -1
+1 -1
drivers/staging/vt6656/firmware.c
··· 61 61 62 62 buffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL); 63 63 if (!buffer) 64 - goto out; 64 + goto free_fw; 65 65 66 66 for (ii = 0; ii < fw->size; ii += FIRMWARE_CHUNK_SIZE) { 67 67 length = min_t(int, fw->size - ii, FIRMWARE_CHUNK_SIZE);