From: sashiko-bot@kernel.org
To: "Balakrishnan Sambath" <balakrishnan.s@microchip.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v6 06/12] media: microchip-isc: set SAM9X7 maximum resolution to 2560x1920
Date: Wed, 03 Jun 2026 07:11:06 +0000 [thread overview]
Message-ID: <20260603071107.4D32E1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603-microchip-isc-fixes-v6-6-8c3d7474a768@microchip.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] The driver checks the machine root compatible string to infer device-specific hardware parameters instead of using a device match table.
Pre-existing issues:
- [High] The driver saves OF endpoint nodes into a persistent list without acquiring a reference, leading to a use-after-free and double-free during probe.
--
commit c91e2880e308dc3e7795189aa50b13e996251309
Author: Balakrishnan Sambath <balakrishnan.s@microchip.com>
media: microchip-isc: set SAM9X7 maximum resolution to 2560x1920
This patch updates the microchip-sama7g5-isc driver to support the SAM9X7
SoC. It reduces the maximum horizontal and vertical resolutions due to
smaller internal line buffer constraints on the SAM9X7 compared to the
SAMA7G5.
> diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> index ca23e8adecbdc..4119cfe12cdf2 100644
> --- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> +++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
> @@ -432,8 +435,13 @@ static int microchip_xisc_probe(struct platform_device *pdev)
> isc->gamma_table = isc_sama7g5_gamma_table;
> isc->gamma_max = 0;
>
> - isc->max_width = ISC_SAMA7G5_MAX_SUPPORT_WIDTH;
> - isc->max_height = ISC_SAMA7G5_MAX_SUPPORT_HEIGHT;
> + if (of_machine_is_compatible("microchip,sam9x7")) {
[Severity: Medium]
Is checking the machine root compatible string the best approach here?
Typically, a device driver relies on its own device node's compatible
string to infer device-specific hardware parameters, rather than the root
machine's compatible string.
Could this be implemented by introducing a new compatible string for the
SAM9X7 XISC (e.g., microchip,sam9x7-isc) to the driver's of_match_table,
and associating the specific resolution limits using
of_device_get_match_data()?
> + isc->max_width = ISC_SAM9X7_MAX_SUPPORT_WIDTH;
> + isc->max_height = ISC_SAM9X7_MAX_SUPPORT_HEIGHT;
> + } else {
> + isc->max_width = ISC_SAMA7G5_MAX_SUPPORT_WIDTH;
> + isc->max_height = ISC_SAMA7G5_MAX_SUPPORT_HEIGHT;
> + }
>
> isc->config_dpc = isc_sama7g5_config_dpc;
[Severity: High]
This isn't a bug introduced by this patch, but while reviewing the probe
sequence, I noticed a potential reference counting issue with the endpoint
nodes.
In xisc_parse_dt(), the endpoint node is assigned without taking a
reference:
xisc_parse_dt() {
...
for_each_endpoint_of_node(np, epn) {
...
subdev_entity->epn = epn;
...
}
Since for_each_endpoint_of_node() drops the reference on the current epn
when it advances, subdev_entity->epn might point to a node whose
reference count has already been decremented.
Later in microchip_xisc_probe(), this endpoint is accessed and explicitly
freed:
microchip_xisc_probe() {
...
list_for_each_entry(subdev_entity, &isc->subdev_entities, list) {
struct fwnode_handle *fwnode =
of_fwnode_handle(subdev_entity->epn);
...
of_node_put(subdev_entity->epn);
...
}
Could this lead to a use-after-free when registering the async remote,
and a double-free when of_node_put() is called? Should the assignment
in xisc_parse_dt() use of_node_get(epn)?
A similar omission also appears to be present in the SAMA5D2 driver
variant in isc_parse_dt().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-microchip-isc-fixes-v6-0-8c3d7474a768@microchip.com?part=6
next prev parent reply other threads:[~2026-06-03 7:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 6:58 [PATCH v6 00/12] media: microchip-isc: fixes and enhancements Balakrishnan Sambath
2026-06-03 6:58 ` [PATCH v6 01/12] media: microchip-isc: fix SBGGR10 Bayer pattern Balakrishnan Sambath
2026-06-03 6:58 ` [PATCH v6 02/12] media: microchip-isc: fix WB offset and gain register field masking Balakrishnan Sambath
2026-06-03 7:14 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 03/12] media: microchip-isc: fix race condition on stream stop Balakrishnan Sambath
2026-06-03 7:22 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 04/12] media: microchip-isc: fix PM runtime leak in AWB work handler Balakrishnan Sambath
2026-06-03 7:17 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 05/12] media: microchip-isc: add driver documentation Balakrishnan Sambath
2026-06-03 7:09 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 06/12] media: microchip-isc: set SAM9X7 maximum resolution to 2560x1920 Balakrishnan Sambath
2026-06-03 7:11 ` sashiko-bot [this message]
2026-06-03 6:58 ` [PATCH v6 07/12] media: microchip-isc: configure DPC and pipeline for SAMA7G5 Balakrishnan Sambath
2026-06-03 7:11 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 08/12] media: microchip-isc: add gamma 1.8 and 2.4 correction curves Balakrishnan Sambath
2026-06-03 6:58 ` [PATCH v6 09/12] media: microchip-isc: add SAMA7G5 hue and saturation controls Balakrishnan Sambath
2026-06-03 7:21 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 10/12] media: microchip-isc: use weighted averages for Grey World AWB Balakrishnan Sambath
2026-06-03 7:14 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 11/12] media: microchip-isc: smooth AWB gains with EMA filter Balakrishnan Sambath
2026-06-03 7:18 ` sashiko-bot
2026-06-03 6:58 ` [PATCH v6 12/12] media: microchip-isc: scale DPC black level to sensor bit depth Balakrishnan Sambath
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=20260603071107.4D32E1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=balakrishnan.s@microchip.com \
--cc=linux-media@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.