From: Robert-Ionut Alexa Date: Fri, 23 Apr 2021 09:01:51 +0000 (+0300) Subject: soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read X-Git-Tag: accepted/tizen/unified/20230118.172025~5331 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9981e39ded4be5a7cfd503fc609e13d7976f82b2;p=platform%2Fkernel%2Flinux-rpi.git soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read [ Upstream commit 8120bd469f5525da229953c1197f2b826c0109f4 ] 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: c93349d8c170 ("soc: fsl: add DPAA2 console support") Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei Signed-off-by: Li Yang Signed-off-by: Sasha Levin --- diff --git a/drivers/soc/fsl/dpaa2-console.c b/drivers/soc/fsl/dpaa2-console.c index 27243f7..5391741 100644 --- a/drivers/soc/fsl/dpaa2-console.c +++ b/drivers/soc/fsl/dpaa2-console.c @@ -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: