From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Aristo Chen <aristo.chen@canonical.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Guoniu Zhou <guoniu.zhou@nxp.com>,
Christian Hemp <c.hemp@phytec.de>,
Jacopo Mondi <jacopo@jmondi.org>,
Stefan Riedmueller <s.riedmueller@phytec.de>,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Aristo Chen <aristo.chen@canonical.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] media: nxp: imx8-isi: Register the media device only once
Date: Sun, 25 Oct 2026 11:46:49 +0200 [thread overview]
Message-ID: <c76885d0057833361d0f5d5ad0c62dec@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20261025082419.199021-1-aristo.chen@canonical.com>
Hello,
This is an automated reply.
You have sent a patch that appears to have been generated by an LLM. The
commit message and/or code show little to no real understanding of the
changes being proposed.
Such patches require a large amount of work to review. They rely on the
maintainer to propose - and often even implement - a proper design. The
probability that the author will learn from the experience to improve
their future contributions is close to zero.
As a result, to make good use of maintainer time and keep the kernel
development process sustainable, your patch has been rejected.
If you believe the change you proposed is important, take time to study
the problem, learn, and develop a solution without AI assistance.
Answering this e-mail or generating a new version of the patch by
feeding this reply to an LLM will only result in your e-mails being
ignored.
Please note that if your patch attempted to address an important
problem, maintainers or other contributors can submit and merge a
similar or entirely different fix without crediting you.
Your contributions to the Linux kernel will be welcome if you genuinely
desire to invest your time and learn.
Thank you,
Laurent's mail bot
On Sun, 25 Oct 2026 08:24:18 +0000, Aristo Chen <aristo.chen@canonical.com> wrote:
> The v4l2-async framework calls the notifier .complete() operation every
> time the last missing subdev gets bound. This happens again each time a
> remote subdev is unbound and bound again, for instance when the sensor
> driver is unbound and rebound through sysfs.
>
> mxc_isi_async_notifier_complete() calls media_device_register()
> unconditionally. Each call allocates and registers a new media devnode
> and overwrites mdev->devnode, so every rebind creates an additional
> /dev/mediaN for the same media device, and leaks the previous devnode
> and its minor number. As media_device_unregister() only unregisters
> the most recent devnode, the older ones also stay registered after the
> ISI is removed, and ioctls on them dereference the freed media_device.
>
> On an i.MX93 board with an AP1302 ISP, every unbind/bind cycle of the
> AP1302 driver adds one /dev/mediaN: after three binds, /dev/media0,
> /dev/media1 and /dev/media2 all expose the same media graph.
>
> Register the media device only if it isn't registered yet. Keep the
> v4l2_device_register_subdev_nodes() call unconditional, as it has to
> create the device nodes of the rebound subdevs, and it already skips
> the subdevs that have one.
>
> The issue was found while debugging an unbind crash in the AP1302
> driver of the NXP BSP kernel. An AI coding assistant helped to find
> it, and wrote this fix and its changelog.
>
> Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
> ---
> Tested on an i.MX93 FRDM board running the NXP BSP kernel
> (lf-6.18.20-2.0.0), whose mxc_isi_async_notifier_complete() is identical
> to mainline, with the AP1302 driver from the same BSP plus a local fix
> that makes it possible to unbind it:
>
> - Without this patch, three unbind/bind cycles of the AP1302 driver
> left /dev/media0, /dev/media1 and /dev/media2.
> - With this patch, after each of three unbind/bind cycles only
> /dev/media0 exists, and media-ctl -p on it shows the rebound AP1302
> and sensor entities. No kernel warnings.
>
> Not tested: the ISI removal path, where the stale devnodes would be
> dereferenced. Build-tested on top of 330517c63aa9 with W=1, no new
> warnings; sparse was not run.
>
> drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> index 0ae5f35e017c..82a03742405d 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c
> @@ -90,6 +90,10 @@ static int mxc_isi_async_notifier_complete(struct v4l2_async_notifier *notifier)
> return ret;
> }
>
> + /* .complete() is called again every time a subdev gets rebound. */
> + if (media_devnode_is_registered(isi->media_dev.devnode))
> + return 0;
> +
> return media_device_register(&isi->media_dev);
> }
>
>
> base-commit: 330517c63aa9b48227b6ab45f01003effac77ae4
prev parent reply other threads:[~2026-10-25 9:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 8:24 Aristo Chen
2026-10-25 9:46 ` Laurent Pinchart [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=c76885d0057833361d0f5d5ad0c62dec@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=Frank.Li@nxp.com \
--cc=aristo.chen@canonical.com \
--cc=c.hemp@phytec.de \
--cc=festevam@gmail.com \
--cc=guoniu.zhou@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jacopo@jmondi.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s.riedmueller@phytec.de \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®