staging: vt6656: Fix possible leak in vnt_download_firmware()
authorChristian Engelmayer <cengelma@gmx.at>
Wed, 11 Feb 2015 19:33:15 +0000 (20:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Mar 2015 00:26:58 +0000 (16:26 -0800)
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>
drivers/staging/vt6656/firmware.c

index a177645af83e6e8d5b37491b0b6096f74fdf55b9..d440f284bf1891c8bec4c1afc95996a8241debea 100644 (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);