lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 304/355] soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read
    Date
    From: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>

    [ 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 <robert-ionut.alexa@nxp.com>
    Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
    Signed-off-by: Li Yang <leoyang.li@nxp.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/soc/fsl/dpaa2-console.c | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/drivers/soc/fsl/dpaa2-console.c b/drivers/soc/fsl/dpaa2-console.c
    index 27243f706f376..53917410f2bdb 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:
    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-15 19:24    [W:4.016 / U:0.664 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site