All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tobias Johansson" <tobias.johansson@axis.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH RESEND 2/2] drm/tiny: sharp-memory: avoid transmitting stale TX buffer data
Date: Tue, 01 Sep 2026 12:08:19 +0000	[thread overview]
Message-ID: <20260901120820.5AD911F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901-flickering-v1-2-eaf7bbf9c000@axis.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing error check for kthread_run() and failure to stop kthread on probe error paths leads to crashes and Use-After-Free.
--

commit 2cf47adb5e86fa285b44ad0bec11eb5287e32f73
Author: Tobias Johansson <tobias.johansson@axis.com>

drm/tiny: sharp-memory: avoid transmitting stale TX buffer data

When only a subset of lines is dirty, the TX buffer sent to the panel contains
stale line data from previous updates, resulting in visible flickering. This
commit fixes sharp_memory_update_display() to transmit only the buffer
entries populated by the current update.

> diff --git a/drivers/gpu/drm/tiny/sharp-memory.c b/drivers/gpu/drm/tiny/sharp-memory.c
> index 595926ed660e5..e7521fc6a0104 100644
> --- a/drivers/gpu/drm/tiny/sharp-memory.c
> +++ b/drivers/gpu/drm/tiny/sharp-memory.c
[ ... ]

This isn't a bug introduced by this patch, but I noticed a pre-existing
issue in sharp_memory_probe():

drivers/gpu/drm/tiny/sharp-memory.c:sharp_memory_probe() {
    ...
		smd->sw_vcom_signal = kthread_run(sharp_memory_sw_vcom_signal_thread,
						  smd, "sw_vcom_signal");
    ...
	ret = drm_dev_register(drm, 0);
	if (ret)
		return dev_err_probe(dev, ret, "Failed to register drm device.\n");
    ...
}

[Severity: High]
Can this lead to a use-after-free if the probe function fails?

If drm_dev_register() fails, the function returns an error without stopping
the running kthread. Devres automatically frees the smd structure, but the
kthread continues executing and may access freed memory.

Additionally, if kthread_run() fails, an ERR_PTR is stored. Will this ERR_PTR
be dereferenced by kthread_stop() during module removal?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-flickering-v1-0-eaf7bbf9c000@axis.com?part=2

      reply	other threads:[~2026-09-01 12:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 11:53 [PATCH RESEND 0/2] drm/tiny: sharp-memory: fix TX buffer corruption on partial update Tobias Johansson
2026-09-01 11:53 ` [PATCH RESEND 1/2] drm/tiny: sharp-memory: fix line address assignment " Tobias Johansson
2026-09-01 12:10   ` sashiko-bot
2026-09-01 11:53 ` [PATCH RESEND 2/2] drm/tiny: sharp-memory: avoid transmitting stale TX buffer data Tobias Johansson
2026-09-01 12:08   ` sashiko-bot [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=20260901120820.5AD911F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tobias.johansson@axis.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 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.