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 <[email protected]>

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/[email protected]?part=2

Reply via email to