Skip to content

Commit 1558b1a

Browse files
GeHao01994Shawn Guo
authored andcommitted
firmware/imx-dsp: Fix use_after_free in imx_dsp_setup_channels()
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 <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent f09752e commit 1558b1a

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
@@ -114,11 +114,11 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc)
114114
dsp_chan->idx = i % 2;
115115
dsp_chan->ch = mbox_request_channel_byname(cl, chan_name);
116116
if (IS_ERR(dsp_chan->ch)) {
117-
kfree(dsp_chan->name);
118117
ret = PTR_ERR(dsp_chan->ch);
119118
if (ret != -EPROBE_DEFER)
120119
dev_err(dev, "Failed to request mbox chan %s ret %d\n",
121120
chan_name, ret);
121+
kfree(dsp_chan->name);
122122
goto out;
123123
}
124124

0 commit comments

Comments
 (0)