From: sashiko-bot@kernel.org
To: "Markuss Broks" <markuss.broks@gmail.com>
Cc: conor+dt@kernel.org, robh@kernel.org, dmitry.torokhov@gmail.com,
linux-input@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/5] Input: imagis - do not report coordinates of released contacts
Date: Fri, 21 Aug 2026 21:39:36 +0000 [thread overview]
Message-ID: <20260821213936.E12AF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260822-imagis-40xx-v1-2-73e6d6cdf110@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] DMA mapping of stack variables in I2C transfer.
- [High] Missing I2C client data initialization leads to a guaranteed NULL pointer dereference during system suspend.
- [High] Unconditionally returning IRQ_HANDLED on I2C failure can cause an interrupt storm.
--
--- Patch [2]: [PATCH 2/5] Input: imagis - do not report coordinates of released contacts ---
commit e577f0168e2b3c0834df658e8cd2f5b4436f2fcb
Author: Markuss Broks <markuss.broks@gmail.com>
Subject: Input: imagis - do not report coordinates of released contacts
This commit modifies the imagis driver to only report the position and
contact area for active contacts. It also prepares the driver for the
IST40xx family, which carries an event type in the contact area bits for
release records.
> diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c
> index 7bbb00beec3be..7cc91f97c06e0 100644
> --- a/drivers/input/touchscreen/imagis.c
> +++ b/drivers/input/touchscreen/imagis.c
[ ... ]
> @@ -127,6 +127,8 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
> finger_pressed = FIELD_GET(IST3038C_FINGER_STATUS_MASK, intr_message);
>
> for (i = 0; i < finger_count; i++) {
> + bool pressed;
> +
> if (ts->tdata->protocol_b)
> error = imagis_i2c_read_reg(ts,
[Severity: High]
This isn't a bug introduced by this patch, but could this I2C read cause DMA
mapping issues?
In imagis_i2c_read_reg(), the variables reg_be and ret_be are allocated
on the stack:
__be32 ret_be;
__be32 reg_be = cpu_to_be32(reg);
struct i2c_msg msg[] = {
{
.addr = ts->client->addr,
.flags = 0,
.buf = (unsigned char *)®_be,
.len = sizeof(reg_be),
},
...
Their addresses are passed directly to i2c_transfer(). If the underlying I2C
adapter relies on DMA and CONFIG_VMAP_STACK is enabled, these stack
addresses reside in vmalloc space and are not DMA-mappable, which can lead
to dma_map_single() failures or memory corruption.
> ts->tdata->touch_coord_cmd + (i * 4),
> @@ -141,9 +143,13 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id)
> goto out;
> }
[Severity: High]
This is a pre-existing issue, but does this error path bypass the kernel's
spurious interrupt detector?
If imagis_i2c_read_reg() fails, the code jumps to the out label which
unconditionally returns IRQ_HANDLED.
If the controller fails to respond, the physical IRQ line might remain
asserted because the device status registers aren't cleared. By returning
IRQ_HANDLED instead of IRQ_NONE, the IRQ core will unmask the line and it
will immediately fire again, potentially creating an interrupt storm that
locks up the CPU core.
>
> + pressed = finger_pressed & BIT(i);
> +
> input_mt_slot(ts->input_dev, i);
> - input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER,
> - finger_pressed & BIT(i));
> + input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, pressed);
> + if (!pressed)
> + continue;
> +
> touchscreen_report_pos(ts->input_dev, &ts->prop,
> FIELD_GET(IST3038C_X_MASK, finger_status),
> FIELD_GET(IST3038C_Y_MASK, finger_status),
[Severity: High]
This is a pre-existing issue, but could system suspend trigger a NULL pointer
dereference?
Looking at imagis_suspend(), it calls i2c_get_clientdata(client) to get the
driver data, but imagis_probe() never sets it via i2c_set_clientdata() or
dev_set_drvdata().
This means i2c_get_clientdata() will return NULL, and the very next line
will dereference it:
struct imagis_ts *ts = i2c_get_clientdata(client);
int error;
guard(mutex)(&ts->input_dev->mutex);
Would it be possible to initialize the client data in imagis_probe() to
prevent this?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260822-imagis-40xx-v1-0-73e6d6cdf110@gmail.com?part=2
next prev parent reply other threads:[~2026-08-21 21:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 21:30 [PATCH 0/5] Minor Imagis driver refactoring and support for IST4050 Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:30 ` [PATCH 1/5] dt-bindings: input: touchscreen: imagis: add compatible " Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:30 ` [PATCH 2/5] Input: imagis - do not report coordinates of released contacts Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:39 ` sashiko-bot [this message]
2026-08-21 21:30 ` [PATCH 3/5] Input: imagis - replace the protocol_b flag with a protocol enum Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:37 ` sashiko-bot
2026-08-21 21:30 ` [PATCH 4/5] Input: imagis - add support for the IST40xx touch reporting format Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:43 ` sashiko-bot
2026-08-21 21:30 ` [PATCH 5/5] Input: imagis - add support for IST4050 Markuss Broks via B4 Relay
2026-08-21 21:30 ` Markuss Broks
2026-08-21 21:42 ` sashiko-bot
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=20260821213936.E12AF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=markuss.broks@gmail.com \
--cc=robh@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.