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.15 423/917] memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()
    Date
    From: Dan Carpenter <dan.carpenter@oracle.com>

    [ Upstream commit beae4a6258e64af609ad5995cc6b6056eb0d898e ]

    The "msh" pointer is device managed, meaning that memstick_alloc_host()
    calls device_initialize() on it. That means that it can't be free
    using kfree() but must instead be freed with memstick_free_host().
    Otherwise it leads to a tiny memory leak of device resources.

    Fixes: 60fdd931d577 ("memstick: add support for JMicron jmb38x MemoryStick host controller")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Link: https://lore.kernel.org/r/20211011123912.GD15188@kili
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/memstick/host/jmb38x_ms.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
    index f9a93b0565e15..435d4c058b20e 100644
    --- a/drivers/memstick/host/jmb38x_ms.c
    +++ b/drivers/memstick/host/jmb38x_ms.c
    @@ -882,7 +882,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)

    iounmap(host->addr);
    err_out_free:
    - kfree(msh);
    + memstick_free_host(msh);
    return NULL;
    }

    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-16 01:42    [W:4.028 / U:0.336 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site