[PATCH v2 0/2] most: core: fix resource leak in most_register_interface error paths

Navaneeth K posted 2 patches 2 months, 2 weeks ago
There is a newer version of this series
drivers/most/core.c     |  9 +++++++--
drivers/most/most_usb.c | 11 +++--------
2 files changed, 10 insertions(+), 10 deletions(-)
[PATCH v2 0/2] most: core: fix resource leak in most_register_interface error paths
Posted by Navaneeth K 2 months, 2 weeks ago
This series fixes a resource leak in most_register_interface() where
early errors (allocation failures) would return without releasing the
device, leaking memory.

It switches to the split device_initialize() + device_add() pattern
to ensure put_device() can be safely called on all error paths.

It also updates the most_usb driver to remove manual error handling
that would otherwise cause a double-free with the new core logic.

Changes in v2:
  - Replaced the previous single-driver fix ("staging: most: dim2: fix
    missing cleanup...") which was NACKed because it introduced a
    double-free risk.
  - Moved the fix to the Core (core.c) to handle cleanup centrally via
    put_device().
  - Updated most_usb.c to remove conflicting manual cleanup.
  - Dropped the dim2.c patch as the upstream code is already correct for
    this new core logic (it relies on the release callback, which core
    now triggers).

Navaneeth K (2):
  most: core: fix resource leak in most_register_interface error paths
  most: usb: remove double cleanup of interface on registration failure

 drivers/most/core.c     |  9 +++++++--
 drivers/most/most_usb.c | 11 +++--------
 2 files changed, 10 insertions(+), 10 deletions(-)