From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Thorsten Blum <blum@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: amijoy - fix memory region leak on registration failure
Date: Sat, 07 Nov 2026 16:18:56 -0800 [thread overview]
Message-ID: <ccc5eb71825e1bd468007e548a8367e7@gmail.com> (raw)
In-Reply-To: <20261107160159.367919-2-blum@kernel.org>
Hi Thorsten,
On Sat, Nov 07, 2026 at 05:01:57PM +0100, Thorsten Blum wrote:
> If input_register_device() fails in amijoy_init(), release the memory
> region for port i before cleaning up the previously registered ports.
>
> Fixes: 127278ce2254 ("Input: joysticks - handle errors when registering input devices")
> Cc: stable@vger.kernel.org
...
> err = input_register_device(amijoy_dev[i]);
> if (err) {
> input_free_device(amijoy_dev[i]);
> + release_mem_region(CUSTOM_PHYSADDR + 10 + i * 2, 2);
> goto fail;
> }
Do we really need this in stable? It has been like this for 20 years,
and only affects an unlikely input_register_device() failure (basically
-ENOMEM during init) on Amiga hardware, so please drop Cc: stable.
Without the constraint of keeping the diff minimal for stable, could we
also clean up the error handling here instead of unwinding inline (and
out of order relative to input_allocate_device() / request_mem_region())?
Either add cascading err_release_mem / err_free_dev labels before the
unregister loop so unwinding happens in reverse order without repeating
input_free_device(), or factor per-port initialization out into a small
amijoy_setup_port() helper.
Thanks.
--
Dmitry
prev parent reply other threads:[~2026-11-08 0:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 16:01 [PATCH] Input: amijoy - fix memory region leak on registration failure Thorsten Blum
2026-11-08 0:18 ` Dmitry Torokhov [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=ccc5eb71825e1bd468007e548a8367e7@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=blum@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.