Commit 4da1edcf authored by Alex Dewar's avatar Alex Dewar Committed by Krzysztof Kozlowski

memory: brcmstb_dpfe: Fix memory leak

In brcmstb_dpfe_download_firmware(), memory is allocated to variable fw by
firmware_request_nowarn(), but never released. Fix up to release fw on
all return paths.

Cc: <stable@vger.kernel.org>
Fixes: 2f330caf ("memory: brcmstb: Add driver for DPFE")
Signed-off-by: default avatarAlex Dewar <alex.dewar90@gmail.com>
Acked-by: default avatarMarkus Mayer <mmayer@broadcom.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20200820172118.781324-1-alex.dewar90@gmail.comSigned-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
parent 296050a0
...@@ -647,8 +647,10 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv) ...@@ -647,8 +647,10 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv)
return (ret == -ENOENT) ? -EPROBE_DEFER : ret; return (ret == -ENOENT) ? -EPROBE_DEFER : ret;
ret = __verify_firmware(&init, fw); ret = __verify_firmware(&init, fw);
if (ret) if (ret) {
return -EFAULT; ret = -EFAULT;
goto release_fw;
}
__disable_dcpu(priv); __disable_dcpu(priv);
...@@ -667,18 +669,20 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv) ...@@ -667,18 +669,20 @@ static int brcmstb_dpfe_download_firmware(struct brcmstb_dpfe_priv *priv)
ret = __write_firmware(priv->dmem, dmem, dmem_size, is_big_endian); ret = __write_firmware(priv->dmem, dmem, dmem_size, is_big_endian);
if (ret) if (ret)
return ret; goto release_fw;
ret = __write_firmware(priv->imem, imem, imem_size, is_big_endian); ret = __write_firmware(priv->imem, imem, imem_size, is_big_endian);
if (ret) if (ret)
return ret; goto release_fw;
ret = __verify_fw_checksum(&init, priv, header, init.chksum); ret = __verify_fw_checksum(&init, priv, header, init.chksum);
if (ret) if (ret)
return ret; goto release_fw;
__enable_dcpu(priv); __enable_dcpu(priv);
return 0; release_fw:
release_firmware(fw);
return ret;
} }
static ssize_t generic_show(unsigned int command, u32 response[], static ssize_t generic_show(unsigned int command, u32 response[],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment