Skip to content

Commit

Permalink
memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc…
Browse files Browse the repository at this point in the history
…_host()

[ 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: 60fdd93 ("memstick: add support for JMicron jmb38x MemoryStick host controller")
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/20211011123912.GD15188@kili
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Dan Carpenter authored and gregkh committed Nov 26, 2021
1 parent da5a9a0 commit 4e93d50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/memstick/host/jmb38x_ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,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;
}

Expand Down

0 comments on commit 4e93d50

Please sign in to comment.