Skip to content

Commit 21b433c

Browse files
GeHao01994smb49
authored andcommitted
firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()
BugLink: https://bugs.launchpad.net/bugs/2049417 [ Upstream commit 1558b1a ] dsp_chan->name and chan_name points to same block of memory, because dev_err still needs to be used it,so we need free it's memory after use to avoid use_after_free. Fixes: e527adf ("firmware: imx-dsp: Fix an error handling path in imx_dsp_setup_channels()") Signed-off-by: Hao Ge <gehao@kylinos.cn> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 3fb0797 commit 21b433c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/firmware/imx/imx-dsp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc)
115115
dsp_chan->idx = i % 2;
116116
dsp_chan->ch = mbox_request_channel_byname(cl, chan_name);
117117
if (IS_ERR(dsp_chan->ch)) {
118-
kfree(dsp_chan->name);
119118
ret = PTR_ERR(dsp_chan->ch);
120119
if (ret != -EPROBE_DEFER)
121120
dev_err(dev, "Failed to request mbox chan %s ret %d\n",
122121
chan_name, ret);
122+
kfree(dsp_chan->name);
123123
goto out;
124124
}
125125

0 commit comments

Comments
 (0)