From: Navaneeth K <knavaneeth786@gmail.com>
To: parthiban.veerasooran@microchip.com,
christian.gromm@microchip.com, gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Navaneeth K <knavaneeth786@gmail.com>
Subject: [PATCH v2 0/2] most: core: fix resource leak in most_register_interface error paths
Date: Tue, 25 Nov 2025 22:56:04 +0000 [thread overview]
Message-ID: <20251125225606.70719-1-knavaneeth786@gmail.com> (raw)
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(-)
next reply other threads:[~2025-11-25 22:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 22:56 Navaneeth K [this message]
2025-11-25 22:56 ` [PATCH v2 1/2] most: core: fix resource leak in most_register_interface error paths Navaneeth K
2025-11-25 23:10 ` Navaneeth K
2025-11-26 17:23 ` Abdun Nihaal
2025-11-25 22:56 ` [PATCH v2 2/2] most: usb: remove double cleanup of interface on registration failure Navaneeth K
2025-11-26 17:31 ` Abdun Nihaal
2025-11-26 22:08 ` Navaneeth K
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251125225606.70719-1-knavaneeth786@gmail.com \
--to=knavaneeth786@gmail.com \
--cc=christian.gromm@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=parthiban.veerasooran@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).