Skip to content

Commit

Permalink
soc: fsl: dpaa2-console: free buffer before returning from dpaa2_cons…
Browse files Browse the repository at this point in the history
…ole_read

Free the kbuf buffer before returning from the dpaa2_console_read()
function. The variable no longer goes out of scope, leaking the storage
it points to.

Fixes: c93349d ("soc: fsl: add DPAA2 console support")
Signed-off-by: Robert-Ionut Alexa <[email protected]>
Signed-off-by: Ioana Ciornei <[email protected]>
Signed-off-by: Li Yang <[email protected]>
  • Loading branch information
Robert-Ionut Alexa authored and Li Yang committed Oct 21, 2021
1 parent dc7e594 commit 8120bd4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/soc/fsl/dpaa2-console.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ static ssize_t dpaa2_console_read(struct file *fp, char __user *buf,
cd->cur_ptr += bytes;
written += bytes;

kfree(kbuf);
return written;

err_free_buf:
Expand Down

0 comments on commit 8120bd4

Please sign in to comment.