android_kernel_motorola_sm6375/drivers/memstick
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Greg Kroah-Hartman 1b8b54fc55 memstick: fix memory leak if card device is never registered
commit 4b6d621c9d859ff89e68cebf6178652592676013 upstream.

When calling dev_set_name() memory is allocated for the name for the
struct device.  Once that structure device is registered, or attempted
to be registerd, with the driver core, the driver core will handle
cleaning up that memory when the device is removed from the system.

Unfortunatly for the memstick code, there is an error path that causes
the struct device to never be registered, and so the memory allocated in
dev_set_name will be leaked.  Fix that leak by manually freeing it right
before the memory for the device is freed.

Cc: Maxim Levitsky <[email protected]>
Cc: Alex Dubov <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Kay Sievers <[email protected]>
Cc: [email protected]
Fixes: 0252c3b4f0 ("memstick: struct device - replace bus_id with dev_name(), dev_set_name()")
Cc: stable <[email protected]>
Co-developed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Co-developed-by: Mirsad Goran Todorovac <[email protected]>
Signed-off-by: Mirsad Goran Todorovac <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2023-04-26 11:24:04 +02:00
..
core memstick: fix memory leak if card device is never registered 2023-04-26 11:24:04 +02:00
host memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host() 2021-11-17 09:48:37 +01:00
Kconfig
Makefile