提交 357f45db 编写于 作者: J Jesper Juhl 提交者: Greg Kroah-Hartman

USB: TI 3410/5052 USB Serial Driver: Fix mem leak when firmware is too big.

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: NJesper Juhl <jj@chaosbits.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 869e9e56
...@@ -1745,6 +1745,7 @@ static int ti_download_firmware(struct ti_device *tdev) ...@@ -1745,6 +1745,7 @@ static int ti_download_firmware(struct ti_device *tdev)
} }
if (fw_p->size > TI_FIRMWARE_BUF_SIZE) { if (fw_p->size > TI_FIRMWARE_BUF_SIZE) {
dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size); dev_err(&dev->dev, "%s - firmware too large %zu\n", __func__, fw_p->size);
release_firmware(fw_p);
return -ENOENT; return -ENOENT;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册