[PATCH] TI 3410/5052 USB Serial Driver: Fix mem leak when firmwareis too big.

From: Jesper Juhl
Date: Mon Jun 13 2011 - 16:59:17 EST


If the size of the firmware exceeds TI_FIRMWARE_BUF_SIZE we'll leak 'fw_p'
by failing to call release_firmware().
This patch fixes the leak.

Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
---
ti_usb_3410_5052.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index c6d92a5..ea84456 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1745,6 +1745,7 @@ static int ti_download_firmware(struct ti_device *tdev)
}
if (fw_p->size > TI_FIRMWARE_BUF_SIZE) {
dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size);
+ release_firmware(fw_p);
return -ENOENT;
}



--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/