From: Dan Carpenter <dan.carpenter@linaro.org>
To: Navaneeth K <knavaneeth786@gmail.com>
Cc: parthiban.veerasooran@microchip.com,
christian.gromm@microchip.com, gregkh@linuxfoundation.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
abdun.nihaal@gmail.com
Subject: Re: [PATCH v4] most: core: fix resource leak in most_register_interface error paths
Date: Thu, 27 Nov 2025 20:06:22 +0300 [thread overview]
Message-ID: <aSiFDhzvuHDyBfJ_@stanley.mountain> (raw)
In-Reply-To: <20251127165337.19172-1-knavaneeth786@gmail.com>
On Thu, Nov 27, 2025 at 04:53:37PM +0000, Navaneeth K wrote:
> The function most_register_interface() did not correctly release resources
> if it failed early (before registering the device). In these cases, it
> returned an error code immediately, leaking the memory allocated for the
> interface.
>
> Fix this by initializing the device early via device_initialize() and
> calling put_device() on all error paths.
>
> The most_register_interface() is expected to call put_device() on
> error which frees the resources allocated in the caller. The
> put_device() either calls release_mdev() or dim2_release(),
> depending on the caller.
>
> Switch to using device_add() instead of device_register() to handle
> the split initialization.
>
> Acked-by: Abdun Nihaal <abdun.nihaal@gmail.com>
> Signed-off-by: Navaneeth K <knavaneeth786@gmail.com>
> ---
Thanks!
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
regards,
dan carpenter
prev parent reply other threads:[~2025-11-27 17:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 16:53 [PATCH v4] most: core: fix resource leak in most_register_interface error paths Navaneeth K
2025-11-27 17:06 ` Dan Carpenter [this message]
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=aSiFDhzvuHDyBfJ_@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=abdun.nihaal@gmail.com \
--cc=christian.gromm@microchip.com \
--cc=gregkh@linuxfoundation.org \
--cc=knavaneeth786@gmail.com \
--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